- ProjectEuler: Contains solutions for projecteuler.net puzzles.
- Leetcode: Solution to leetcode.com algorithm problems.
- InterviewBits: Solution to inteviewbits.com puzzles.
- Sorting: C++ implementation of few simple sorting algorithms.
-
Fill an array with a single value
Arrays.fill(intArray,1);
-
Convert an array to linked list
Integer[] arr = {1, 2, 3}; List<Integer> list = new ArrayList<Integer>(Arrays.asList(arr));
Notice arr of Integer array not int array
-
Print an array
System.out.println(Arrays.asString(arr));
- List : ArrayList, LinkedList
- HashTable
- Stack
- Deque: ArrayDeque, ConcurrentLinkedDeque, LinkedBlockingDeque, LinkedList
- Iterate a HashMap
- Iterate a PriorityQueue
- Implement a QuickSort using the java API to sort a custom object.
- Implement Heap data structure.
- Difference between HashTable and HashMap.
- Concrete implementation of interface collections.
- Read the Collections APIs.
Pair is not natively supported in Java but we can use Map.Entry object to achieve the same objective.
Concrete implementations of Map.Entry.
- AbstractMap.SimpleEntry<K,V>
- AbstractMap.SimpleImmutableEntry<K,V>
- Array: array.length
- String: string.length()
- Collection object(Stack, Queue, List): object.size()
- Convert a integer to character
Character.forDigit(int_value, 10);
- Convert a String to character array
string.toCharArray()
String to int: Integer.parseInt("1"); Char to int: Character.getNumericValue('1'); int to String: Integer.toString(1);
Find all unique combinations in an array where sum equals to a value https://leetcode.com/problems/combination-sum-ii/
Find subsets of set with unique elements https://www.interviewbit.com/problems/subset/
Find unique subsets with duplicates: https://www.interviewbit.com/problems/subsets-ii/
Find unique permutations with duplicates: https://www.interviewbit.com/problems/all-unique-permutations/
Find all the permutations of a set https://www.interviewbit.com/problems/permutations/
Find the largest continuous sequence in a array which sums to zero. https://www.interviewbit.com/problems/largest-continuous-sequence-zero-sum/
Dynamic Problem collection
Find Bitonic (first increasing then decreasing) subsequence in an Array https://www.geeksforgeeks.org/dynamic-programming-set-15-longest-bitonic-subsequence/