This question was asked by Jane Street. Can you solve it? (1032. Stream of Characters)

  Рет қаралды 39,748

Jack Tech

Jack Tech

Күн бұрын

Пікірлер: 24
@deadlyecho
@deadlyecho Жыл бұрын
I implemented a similar data structure for a game, called Scrabble, the data structure is called GADDAG which is based upon the DAWG data structure, "Directed Asyclic Word Graph", the main objective was to efficiently generate all the possible moves given the rack of letters.. and this GADDAG dictionary was to make sure that the move formed a correct word.
@cookingsection568
@cookingsection568 Жыл бұрын
Me clicking this video when I have never done programming in my life.
@Febrin42
@Febrin42 7 ай бұрын
As @russellgerhard4637 mentioned it would be faster if we build the Trie backwards. Then we can iterate on the stream backwards, and we either end up in a terminal node (meaning that this suffix is a correct word) or we break as there is no transition
@EdDunkle
@EdDunkle 2 ай бұрын
I'm in perpetual dummy mode
@JacobDlougach
@JacobDlougach Жыл бұрын
Why haven't you even mentioned Aho-Corasick? That would be a true linear solution.
@DJHypnovibe
@DJHypnovibe Жыл бұрын
I started coding in assembly, then pascal, then C, and anything with strings and search can usually be sped up using binary proxies. I'd create some reduced binary representation of each word, chain them together, and then use math to quickly deduce if anything from my stream was in my overall target. I usually can speed up code at most companies written by recent CS and math grads. At one gig last year, this major payments processing company had a job that would run for 5 hours, and I devised an algorithm that would calculate the same result in a couple of minutes.
@Zwieq
@Zwieq Жыл бұрын
Woah🔥🔥
@TheMrKlowb
@TheMrKlowb Жыл бұрын
Wow that sounds like a lot of bullshit.
@russellgerhard4637
@russellgerhard4637 2 жыл бұрын
Hey Jack, thanks for the video! I have a few questions about the trie solution. First, let's say 'n' is the number of words and 'm' is the number of calls to query. With a trie, for each call to query we just need to traverse the trie. Let's call 'k' the length of the longest word in the word list. I believe the worst case runtime would be O(m*k) because on each query we're traversing down k nodes in the trie. Second, I also believe the brute force search of the entire word list would be O(m*n*k), because for each query call I must compare every word to the stream, and comparing each word requires a letter by letter comparison of at worst k letters. For the space of the trie, we could imagine a vast list of words: let's say every permutation of the English alphabet (26 characters) whose length is less than or equal to the max word length k. At each depth of the trie, we have 26 new possibilities. The max depth of the trie is k. So the total space required, in the worst case, would be 26^k. More generally, if 'a' is the size of your alphabet, then the size complexity is on the order of a^k. Finally, if we wanted to append to the back of the list, we could write the trie constructor such that it puts words into the trie backwards. This way, we just read off of the back of list to move down a path in the trie. I think it's likely I'm not totally correct because this is a rather complex problem, so let me know your thoughts!
@JackHeTech
@JackHeTech 2 жыл бұрын
Hey sorry for the late reply! Your analysis makes sense, I was bulk making these videos cause I had an internship coming up so a few details I got wrong. It's awesome to see the engagement tho! I'll do better in future uploads.
@morpheusft7633
@morpheusft7633 Жыл бұрын
But why would you need to store the stream at all? That does not seem to be a requirement.
@varunvummadi350
@varunvummadi350 2 жыл бұрын
Thanks for making awesome videos Can you make a video on how to prepare for these companies
@paragggoyal1552
@paragggoyal1552 3 ай бұрын
O(nm) ? Its going to be o(m*(max length of a word))
@alidir7570
@alidir7570 Жыл бұрын
Hello Is this question for an internship in quant developing? Could it be asked in quant trading interviews?
@sidasdf
@sidasdf 11 ай бұрын
A little late to the party, but you should not expect a question like this in a trading interview.
@leonmozambique533
@leonmozambique533 2 жыл бұрын
suffix tree bro
@user-dz6zd9zk2f
@user-dz6zd9zk2f Жыл бұрын
Can't we just use a hashmap to store the words instead of a list. That way the search complexity will become O(1) and the overall solution will become O(n).
@wrong1029
@wrong1029 Жыл бұрын
You may not have the entire word, so a hashmap is no good here.
@jwh523
@jwh523 3 ай бұрын
ac automata
@themisfowl1333
@themisfowl1333 Жыл бұрын
ez trie problem bro
@GauravSingh-bo1ys
@GauravSingh-bo1ys Жыл бұрын
Leetcode 1032
@hdrkn5247
@hdrkn5247 3 ай бұрын
talk is cheap. show us the code!
From Small To Giant 0%🍫 VS 100%🍫 #katebrush #shorts #gummy
00:19
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 36 МЛН
Twin Telepathy Challenge!
00:23
Stokes Twins
Рет қаралды 122 МЛН
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 5 МЛН
How much do Software Engineers earn in Zurich, Switzerland?
15:22
Claudia and Jan
Рет қаралды 106 М.
Jane Street's $7 Billion Haul Is a Good Wall Street Omen
4:18
Bloomberg Television
Рет қаралды 4,9 М.
How I landed a software engineering internship at Citadel
7:47
How to Play Figgie | Jane Street Card Game Tutorial
5:36
Jane Street
Рет қаралды 2,6 М.
Jane Street about the programming contests and internships
6:02
ICPC North America
Рет қаралды 2,6 М.
day in the life of a software engineer at a trading company
10:13
Excelling in Quantitative Trading as an Algorithm Developer
4:11
Hudson River Trading
Рет қаралды 44 М.
Jane Street Puzzle Solved
8:53
ChrisIdk
Рет қаралды 5 М.
From Small To Giant 0%🍫 VS 100%🍫 #katebrush #shorts #gummy
00:19