Incubate Startups • Constantly Learning Founded June 2012 Continuous Learning Hard Work Sharing Software Engineer Product Manager System Engineer UX Designer Data Scientist Data Analyst JKT BDG JOG SBY DPS International & national 99 Competitions 255
Problem-solving skills are valuable 3. Basic data structure and algorithm knowledge is useful 4. Whiteboards let you focus on what matters Why do things this way? 14
are you evaluated? How does an interviewer know what to expect of you? 2. I didn't hear back immediately after my interview. Am I rejected? 3. Can I re-apply to a company after getting rejected? 15
the phone. 2. On-site interview. 3. After your interview, your interviewers will provide feedback in some form. 4. Most companies get back after about a week with next steps. (offer, rejection, further interviews, or just an update on the process). 16
the big project classes • Get an internship • Become lab/teaching assistant • Start something Two big things that companies want to see: that you're smart and that you can code
3 - 12 Months • • 1+ Years 1+ Years - Build project outside of school. - Expand network. - Find internship and take classes with large projects. 3-12 Months - Continue to work on projects. - Create draft of CV. - Make list of prefered companies. - Practice interview questions.
3 - 12 Months • • 1+ Years • 1 - 3 Months 4 Weeks • 1-3 Months - Do mini-projects. - Do mock interviews. - Continue to practice interview questions. 4 Weeks - Review/update CV. - Begin applying to companies. - Do another mock interview and continue to practice questions, writing code on paper.
Day before • • 1 Week 1 Week - Phone interview. - Do a final mock interview. - Continue to practice interview questions. Day before - Continue to practice questions & review your list of mistakes. 3 - 12 Months • • 1+ Years • 1 - 3 Months 4 Weeks •
• • 1 Week 3 - 12 Months • • 1+ Years • 1 - 3 Months 4 Weeks • • Day of After • Preparation Map Day Of - Eat a good breakfast & be on time. - Be confident (not cocky). - Remember to talk out loud. After - Write thank you note to recruiter. - If you haven’t heard from recruiter, check in after one week. - If no offer, ask why and when you can re-apply.
days to couple weeks out. • If you're still waiting to hear back from other companies, you can ask for an extension. • Companies will usually try to accommodate this, if possible. 27
on good terms and keep a line of communication open. • When you decline an offer, provide a reason that is non-offensive and inarguable. • But, be honest and be professional! Declining an Offer 28
mean that you're not a great engineer. • Lots of great engineers do poorly, either because they don't "test well" on these sort of interviewers, or they just had an "off" day. • Companies are often eager to re-interview previously rejected candidate. • You can also ask for feedback from the recruiter. 29
are you still in there? 2. Build Strong Relationships At work, establish strong relationships with your manager and teammates. When employees leave, keep in touch with them. 3. Ask for What You Want Be (reasonably) frank about your goals with your manager, like “want to take on more back-end coding projects” 4. Keep Interviewing a. Set a goal of interviewing at least once a year, even if you aren’t actively looking for a new job. b. If you get an offer, you don’t have to take it. It will still build a connection with that company in case you want to join at a later date. 31
values in an array • O (big O): upper bound on the time. O(n), O(n2), O(n3), O(2n) • Ω (big omega): lower bound. Ω(n), Ω(log n), Ω(1) • Θ (big theta): means both O and Ω. That is, an algorithm is Θ(n) if it is both O(n) and Ω(n) Industry's meaning of big O is closer to what academics mean by Θ. Best Case, Worst Case, Expected (Average) Case. 35 Complexity
0; for (int i = 0; i < n; ++i) { sum += (i + i + 1); } return sum; } Time is not the only thing that matters in an algorithm. We might also care about the amount of memory - or space - required by an algorithm. int sum(int n) { if (n <= 0) { return 0; } return n + sum(n - 1); } 36
attention to any information in the problem description. Listen Debug your example. Is there any way it’s a special case? Is it big enough? Draw an Example Get a brute force solution as soon as possible. Don’t code yet though! Brute Force 1. Conceptual test 2. Unusual or non-standard code 3. Hot spots, like null nodes 4. Small test case. Measure time complexity 5. Special cases and edge cases Test Walk through you brute force with BUD (Bottlenecks, Unnecessary, Duplicated) optimization. Optimize Your goal is to write beautiful code. Modularize your code from the beginning and refactor to clean up anything that isn’t beautiful. Keep talking! Implement
most common things that an algorithm can waste time doing. Walk through your brute force looking for these things. When you find one of them, focus on getting rid of it. 40
you first sort the array O(n log n) and then find elements with a particular property O(n). Perhaps you could reduce O(n) to O(1), but would it matter? 41
the equation a3 + b3 = c3 + d3, (1 ≤ a, b, c, d ≤ 1000) n = 1000 for a from 1 to n for b from 1 to n for c from 1 to n for d from 1 to n if a3 + b3 == c3 + d3 print a, b, c, d O(N4) n = 1000 for a from 1 to n for b from 1 to n for c from 1 to n for d from 1 to n if a3 + b3 == c3 + d3 print a, b, c, d break O(N4) n = 1000 for a from 1 to n for b from 1 to n for c from 1 to n d = pow(a3 + b3 - c3, 1/3) if a3 + b3 == c3 + d3 print a, b, c, d O(N3) 42 a3 + b3 - c3 = d3
through all (a, b) pairs and searching all (c, d) pairs to ﬁnd if there are any matches to that (a, b) pair n = 1000 for c from 1 to n for d from 1 to n result = c3 + d3 append (c, d) to list map[result] for a from 1 to n for b from 1 to n result = a3 + b3 list = map.get(result) for each pair in list print a, b, pair n = 1000 for c from 1 to n for d from 1 to n result = c3 + d3 append (c, d) to list at map[result] for each result, list in map for each pair1 in list for each pair2 in list print pair1, pair2 43
◦ Number are randomly generated and stored into an (expanding) array. How would you keep track of the median? 44 ◦ Probably not! Tend not to do very well with accessing and sorting numbers ◦ Maybe, but you already have an array. Could you somehow keep the elements sorted? ◦ This is possible, but how? ◦ A heap is really good at basic ordering and keeping track of max and mins.
thought of as correct or incorrect. 2. Your performance is evaluated in comparison to other candidates. 3. Many-possibly most-questions are too difficult to expect even a strong candidate to immediately spit out the optimal algorithm. 46
a question before, admit this to your interviewer. • Your interviewer is asking you these questions in order to evaluate your problem-solving skills. • Additionally, your interviewer may find it highly dishonest if you don't reveal that you know the question. 47
and Queues 4. Tree and Graphs 5. Bit Manipulation 6. Math and Logic Puzzles 7. Object Oriented Design 8. Recursion and Dynamic Programming 9. System Design and Scalability 10. Sorting and Searching 11. Testing 12. C and C++ (Optional) 13. Java (Optional) 14. Databases 15. Threads and Locks 16. Moderate (Optional) 17. Hard (Optional) What you need to know!
structure that maps keys to values for highly efﬁcient lookup • ArrayList ◦ Fixed length • Resizable Arrays ◦ Dynamically resizable • StringBuilder ◦ StringBuilder simply creates a resizable array of the strings A good exercise to practice strings, arrays, and general data structures is to implement your own version of StringBuilder, HashTable and ArrayList. 1. Arrays and Strings (Overview) •••
a string, write a function to check if it is a permutation of a palindrome. A permutation is a rearrangement of letters. The palindrome does not need to be limited to just dictionary words. is a word or phrase that is the same forwards and backwards gigi: ggii, gigi, giig, igig, iggi, iigg
{ int countOdd = 0; int[] table = new int[Character.getNumericValue('z') - Character.getNumericValue('a') + 1]; for (char c : phrase.toCharArray()) { int x = getCharNumber(c); if (x != -1) { table[x]++; if (table[x] % 2 == 1) { countOdd++; } else { countOdd--; } } } return countOdd <= 1; } g 1 1 i 1 2 g 2 1 i 2 0 s 1 1 a 1 2 r 1 3 a 2 2 s 2 1
linked list does not provide constant time access to a particular index within the list. This means that if you'd like to find the K-th element in the list, you will need to iterate through K elements. The benefit of a linked list is that you can add and remove items from the beginning of the list in constant time.
LinkedListNode current = head; while (current != null) { /* remove all future nodes that have the same value */ LinkedListNode runner = current; while (runner.next != null) { if (runner.next.data == current.data) { runner.next = runner.next.next; } else { runner = runner.next; } } current = current.next; } }
observation • GCD, LCM • Prime Numbers ◦ Sieve Eratosthenes • Probability ◦ and, P(A and B) = P(B | A) P(A) ◦ or, P(A or B) = P(A) + P(B) - P(A and B) ◦ independence, P(A and B) = P(A) P(B) ◦ mutual exclusivity, P(A or B) = P(A) + P(B)
is an 8x8 chessboard in which two diagonally opposite corners have been cut off. You are given 31 dominos, and a single domino can cover exactly two squares. Can you use the 31 dominos to cover the entire board? Prove your answer.
require a candidate to sketch out the classes and methods to implement technical problems or real-life objects. You have to create elegant, maintainable object-oriented code. How to approach: 1. Handle ambiguity (Ask questions to clarify) 2. Define the core object like Table, Employee, Host, etc 3. Analyze relationships 4. Investigate actions
of spots. • motorcycles, cars, and buses. • motorcycle spots, compact spots, and large spots. • A motorcycle can park in any spot. • A car can park in either a single compact spot or a single large spot. • A bus can park in five large spots that are consecutive and within the same row. It cannot park in small spots. 7. Object-Oriented Design (Solution) ••••
to approach: ◦ Bottom-Up ▪ Solve simple case, like a list with only one element, then solve the problem with two elements, three, and so on. ◦ Top-Down ▪ Divide the problem for case N into subproblems. ◦ Half-and-Half ▪ Divide data set in half, and merge together. • Recursive vs Iterative • Memoization ◦ Example problem: Fibonacci numbers
A child is running up a staircase with n steps and can hop either 1 step, 2 steps, or 3 steps at a time. Implement a method to count how many possible ways the child can run up the stairs.
are given two sorted arrays, A and B, where A has a large enough buffer at the end to hold B. Write a method to merge B into A in sorted order. 1 2 3 4 5 6 2 3 4 6
int[] b, int lastA, int lastB) { int indexA = lastA - 1; // Index of last element in array a int indexB = lastB - 1; // Index of last element in array b int indexMerged = lastB + lastA - 1; // end of merged array while (indexB >= 0) { if (indexA >= 0 && a[indexA] > b[indexB]) { a[indexMerged] = a[indexA]; // copy element indexA--; } else { a[indexMerged] = b[indexB]; // copy element indexB--; } indexMerged--; // move indices } }
who understands what the software is really about? • Knowing how the pieces fit together ◦ Do you understand how software works, and how it might fit into a greater ecosystem? • Organization ◦ Do you approach the problem in a structured manner, or do you just spout off anything that comes to your head? • Practicality ◦ Can you actually create reasonable testing plans? 11. Testing (Overview) •••
query to get a list of tenants who are renting more than one apartment. Apartments AptID int UnitNumber varchar(10) BuildingID int AptTenants TenantID int AptID int Tenants TenantID int TenantName varchar(100)
company to assess your general understanding of threads, particularly your understanding of deadlocks. • Thread vs process • Synchronization methods • Locks • Deadlocks and Deadlock Prevention 15. Threads and Locks (Overview) •••
be thought of as an instance of a program in execution. A process is an independent entity to which system resources (e.g., CPU time and memory) are allocated. A thread exists within a process and shares the process resources (including its heap space) . A thread is a particular execution path of a process. When one thread modifies a process resource, the change is immediately visible to sibling threads.
to count the pairs of multiples of 5 and 2. There will always be more multiples of 2 than 5, though, so simply counting the number of multiples of 5 is sufficient. 16. Moderate (Solution) ••
759 + 674, but "forget" to carry. Get 323. 2. Add 759 + 674 but only do the carrying, rather than the addition of each digit. Get 1110. 3. Add the result of the first two operations (recursively, using the same process described in step 1 and 2): 323 + 1110 = 1433 Step 1 can be done using bitwise xor operator. Step 2 can be done using bitwise and operator. Recurse until there's nothing to carry. 17. Hard (Solution) ••