Permutation of multiple arrays and iterator tutorial

permutation of multiple arrays tutorial

Backstory: Permutation of multiple arrays is a recursion question. The interview question adds a twist to it. You also need to implement an iterator to iterate through the element after permutation. Basically it asks for the implementation of hasNext() and next() functions. This tutorial gives the solution to it. Why …

Continue reading

Word break using memoization tutorial

word break tutorial

Backstory: Word break tutorial explains how to use memoization to solve word break problem. Memoization is one of the dynamic programming technique. After applying memoization, the complexity reduces from exponential level to O(n^3). Why I picked this question: It is intimidating to study Dynamic programming. Actually dynamic programming is not …

Continue reading

Autocomplete with trie tutorial

autocomplete with trie tutorial

Backstory: Autocomplete with trie tutorial teaches how to implement trie and use it to solve automcomplete problem, a popular interview question. This is a question from Amazon for software engineer position. The interviewer specifically asks to use trie. Why I picked this question: When I studied Computer Science in college …

Continue reading

HashMap object as key and sort tutorial

Hashmap object as key and sort tutorial

Backstory: HashMap object as key and sort tutorial explains how to override hashCode() and equals() and use TreeMap in order to use sort by object. This is a basic question in Java Collections HashMap. It normally asked in phone screening. Why I picked this question: I liked to use HashMap …

Continue reading

Initialize game board in matrix tutorial

initialize game board in matrix tutorial

Backstory: Initialize game board tutorial introduces the solution how to initialize a game board on a matrix. The question requests that no 3 adjacent cells can be the same. When you detect the situation, you need to replace with different digits. Why I picked this question: Matrix is not a …

Continue reading

Find random number not in array tutorial

Find random number not in array tutorial

Backstory: Find random number not in array tutorial introduces the solution to get the complement set (negative space) of the original array first. Then, you can find random number from the complement set. This is a Google online screening question. Why I picked this question: When we work with data …

Continue reading

Clean directories with recursion tutorial

clean directories with recursion tutorial

Backstory: Clean directories with recursion tutorial introduces how to use file class and methods to remove the old files or empty directories using recursion. This question is from LinkedIn for software engineer position. Why I picked this question: In everyday work, we don’t need to remember every methods in Java …

Continue reading

Sort squares with optimization tutorial

sort squares tutorial

Backstory: Sort squares tutorial shows how to sort by using “merge sorted arrays” technique. This improves complexity from O(nlogn) to O(n). This question is from VMware for senior software engineer position. Why I picked this question: It shows the variety of merge-sorted-array question. And be aware the interviewer is always …

Continue reading

Merge two sorted arrays tutorial

merge sorted arrays tutorial

Backstory: Merge sorted arrays tutorial introduces 2 solutions to merge sorted array. This will help with the followup questions in the interview. The question might show up under disguise (See Sort squares). Make sure to prepare for it. Why I picked this question: This is a must-know interview question. Recommended: …

Continue reading

Selection sort tutorial

Selection sort tutorial

Backstory: Selection sort tutorial gives an intuitive but not most efficient solution of sorting. Sorting algorithms such as bubble sort, merge sort or quick sort are too important to ignore. You must know at least one of it. Why I picked this question: Selection sort is most intuitive sorting algorithm. …

Continue reading