Data structures and algorithms - jyotiprasadpal/useful-resources GitHub Wiki
Video courses
- Aditya Verma | Youtube
- Data Structures and Algorithms: Deep Dive Using Java | Tim Buchalka |Udemy
- JavaScript Algorithms and Data Structures Masterclass | Colt Steele | Udemy
- Master the Coding Interview: Data Structures + Algorithms | | Andrei Neagoie | Udemy
- The Coding Interview Bootcamp: Algorithms + Data Structures | Stephen Grider | Udemy
- Practical Data Structures & Algorithms in Java + HW
- Recursion, Backtracking and Dynamic Programming in Java
- Advanced Algorithms (Graph Algorithms) in Java
Books
Blogs/Articles/Tutorials
Hashing
Divide and Conquer
Recursion
Dynamic programming
Greedy algorithms
Two pointer technique
- Two pointer technique - leetcode
- Two pointer technique - geeksforgeeks
- Two pointer technique - hackerrank
Frequency counter technique
Backtracking
-
Questions to practice
Questions
Write a method to add numbers in an array without using any loops or Linq.
Find the duplicates in an array.
https://mkyong.com/java8/java-8-find-duplicate-elements-in-a-stream/#:~:text=In%20Java%208%20Stream%2C%20filter,stream()%20.
Find duplicates in an array or list using java streams? -Find the first recurring number in an array.
https://www.geeksforgeeks.org/program-to-print-first-n-prime-numbers/
Find the prime numbers between 1 to 100 and print in ascending order. -Find the most frequently occurring word in a paragraph.
Reverse a string
Is recursion good or bad?
https://stackoverflow.com/questions/41469031/is-recursion-a-bad-practice-in-general
Find all permutations of a string.
https://www.geeksforgeeks.org/print-all-permutations-of-a-string-in-java/
Find the first non-repeating element in a given array of integers.
https://www.geeksforgeeks.org/non-repeating-element/?ref=lbp
Find the kth largest element in a given array of integers.
Design a hashtable/hashmap and make them iterable so that one can use for loop construct.
- https://levelup.gitconnected.com/leetcode-706-design-hashmap-march-leetcoding-challenge-2021-fdae1a4adbc?gi=fad43ca9391
- https://www.codingninjas.com/codestudio/library/implementation-of-hashmap
Design a linked list and make them iterable so that one can use for loop construct.
https://www.geeksforgeeks.org/java-implementing-iterator-and-iterable-interface/
Write a program to check if a string can be converted to palindrome or not. For example, string "mmo" can be converted, so return true.
Create a function that takes a Roman numeral as its argument and returns its value as a numeric decimal integer. You don't need to validate the form of the Roman numeral.
Modern Roman numerals are written by expressing each decimal digit of the number to be encoded separately, starting with the leftmost digit and skipping any 0s. So 1990 is rendered "MCMXC" (1000 = M, 900 = CM, 90 = XC) and 2008 is rendered "MMVIII" (2000 = MM, 8 = VIII). The Roman numeral for 1666, "MDCLXVI", uses each letter in descending order.
Write a function that takes a string input, and returns the first character that is not repeated anywhere in the string. Characters in strings consist of printable characters.
As an added challenge, upper- and lowercase letters are considered the same character, but the function should return the correct case for the initial letter. For example, the input 'sTreSS' should return 'T'. If a string contains all repeating characters, it should return the empty string ("").
public static String firstNonRepeatingLetter(String str) {
for(char i: str.toCharArray()){
if(str.indexOf(i) == str.lastIndexOf(i)){
return String.valueOf(i);
}
}
return "";
}
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.
Find first repeating character in a string say "Hello". Time complexity?
public int solution(int number) {
//TODO: Code stuff here]
int total = 0;
for(int i = 1; i < number; i++){
if(i % 3 == 0 || i % 5 == 0){
System.out.println(i);
total += i;
}
}
System.out.println(total);
return total;
}
There are streams of data coming in. For example, stock prcies. You need to find greatest 3 numbers any time in optimal way?
Which data structure in Java would you use to store data? What is the time and space complexity?
Stock prices: 100, 200, 300, 400, 50 Hint: Use SortedLinkedList (insertion sort) or TreeSet ()
class MyCollection{
getMax3Elements() {
}
add(n) {
}
}