From b1992b3e60bfffa7727f35ba60bb18e09c4b7525 Mon Sep 17 00:00:00 2001 From: rshaghoulian <9rodney@gmail.com> Date: Fri, 10 Mar 2017 01:10:37 -0600 Subject: [PATCH] Added 28 solutions --- .../The Coin Change Problem/Solution.java | 60 ++++ .../Append and Delete/Solution.java | 37 +++ .../Solution.java | 29 ++ .../Beautiful Triplets/Solution.java | 34 +++ .../Between Two Sets/Solution.java | 71 +++++ .../Implementation/Bon Appetit/Solution.java | 31 ++ .../Divisible Sum Pairs/Solution.java | 48 +++ .../Equalize the Array/Solution.java | 25 ++ .../Extra Long Factorials/Solution.java | 24 ++ .../Implementation/Find Digits/Solution.java | 30 ++ .../Solution.java | 31 ++ .../Jumping on the Clouds/Solution.java | 31 ++ .../Implementation/Kangaroo/Solution.java | 25 ++ .../Implementation/Library Fine/Solution.java | 36 +++ .../Manasa and Stones/Solution.java | 42 +++ .../Modified Kaprekar Numbers/Solution.java | 40 +++ .../Repeated String/Solution.java | 33 +++ .../Save the Prisoner!/Solution.java | 20 ++ .../Sequence Equation/Solution.java | 30 ++ .../Sherlock and Squares/Solution.java | 20 ++ .../Sock Merchant/Solution.java | 31 ++ .../Taum and B'day/Solution.java | 23 ++ .../The Hurdle Race/Solution.java | 24 ++ .../Implementation/Utopian Tree/Solution.java | 37 +++ .../Viral Advertising/Solution.java | 21 ++ Algorithms/README.md | 51 ++-- .../Search/Ice Cream Parlor/Solution.java | 33 +-- Algorithms/Warmup/Plus Minus/Solution.java | 6 +- .../Solution.java | 33 +-- .../Data Structures MCQ 1/Solution.txt | 18 ++ .../Data Structures MCQ 2/Solution.txt | 11 + .../Data Structures MCQ 3/Solution.txt | 10 + Data Structures/README.md | 218 +++++++------- .../{Java MDS => Java MD5}/Solution.java | 0 Java/README.md | 2 +- .../Pattern Syntax Checker/Solution.java | 4 + README.md | 277 +++++++++--------- 37 files changed, 1187 insertions(+), 309 deletions(-) create mode 100644 Algorithms/Dynamic Programming/The Coin Change Problem/Solution.java create mode 100644 Algorithms/Implementation/Append and Delete/Solution.java create mode 100644 Algorithms/Implementation/Beautiful Days at the Movies/Solution.java create mode 100644 Algorithms/Implementation/Beautiful Triplets/Solution.java create mode 100644 Algorithms/Implementation/Between Two Sets/Solution.java create mode 100644 Algorithms/Implementation/Bon Appetit/Solution.java create mode 100644 Algorithms/Implementation/Divisible Sum Pairs/Solution.java create mode 100644 Algorithms/Implementation/Equalize the Array/Solution.java create mode 100644 Algorithms/Implementation/Extra Long Factorials/Solution.java create mode 100644 Algorithms/Implementation/Find Digits/Solution.java create mode 100644 Algorithms/Implementation/Jumping on the Clouds - Revisited/Solution.java create mode 100644 Algorithms/Implementation/Jumping on the Clouds/Solution.java create mode 100644 Algorithms/Implementation/Kangaroo/Solution.java create mode 100644 Algorithms/Implementation/Library Fine/Solution.java create mode 100644 Algorithms/Implementation/Manasa and Stones/Solution.java create mode 100644 Algorithms/Implementation/Modified Kaprekar Numbers/Solution.java create mode 100644 Algorithms/Implementation/Repeated String/Solution.java create mode 100644 Algorithms/Implementation/Save the Prisoner!/Solution.java create mode 100644 Algorithms/Implementation/Sequence Equation/Solution.java create mode 100644 Algorithms/Implementation/Sherlock and Squares/Solution.java create mode 100644 Algorithms/Implementation/Sock Merchant/Solution.java create mode 100644 Algorithms/Implementation/Taum and B'day/Solution.java create mode 100644 Algorithms/Implementation/The Hurdle Race/Solution.java create mode 100644 Algorithms/Implementation/Utopian Tree/Solution.java create mode 100644 Algorithms/Implementation/Viral Advertising/Solution.java create mode 100644 Data Structures/Multiple Choice/Data Structures MCQ 1/Solution.txt create mode 100644 Data Structures/Multiple Choice/Data Structures MCQ 2/Solution.txt create mode 100644 Data Structures/Multiple Choice/Data Structures MCQ 3/Solution.txt rename Java/Advanced/{Java MDS => Java MD5}/Solution.java (100%) diff --git a/Algorithms/Dynamic Programming/The Coin Change Problem/Solution.java b/Algorithms/Dynamic Programming/The Coin Change Problem/Solution.java new file mode 100644 index 0000000..cb4ba96 --- /dev/null +++ b/Algorithms/Dynamic Programming/The Coin Change Problem/Solution.java @@ -0,0 +1,60 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; +import java.util.HashMap; + +/* Use a HashMap as a cache to speed up runtime + * + * Tricky: Must use "long" instead of "int" to avoid integer overflow +*/ +public class Solution { + + public static void main(String[] args) { + /* Read and save input */ + Scanner scan = new Scanner(System.in); + int n = scan.nextInt(); + int m = scan.nextInt(); + int coins[] = new int[m]; + for (int coins_i = 0; coins_i < m; coins_i++) { + coins[coins_i] = scan.nextInt(); + } + scan.close(); + + System.out.println(numWays(n, coins)); + } + + public static long numWays(int n, int [] coins) { + if (n < 0) { + return 0; + } + return numWays(n, coins, 0, new HashMap()); + } + + public static long numWays(int n, int [] coins, int coinNumber, HashMap cache) { + /* Check our cache */ + String key = n + "," + coinNumber; + if (cache.containsKey(key)) { + return cache.get(key); + } + /* Base case */ + if (coinNumber == coins.length - 1) { + if (n % coins[coinNumber] == 0) { + cache.put(key, 1L); + return 1; + } else { + cache.put(key, 0L); + return 0; + } + } + /* Recursive case */ + long ways = 0; + for (int i = 0; i <= n; i += coins[coinNumber]) { + ways += numWays(n - i, coins, coinNumber + 1, cache); + } + /* Cache and return solution */ + cache.put(key, ways); + return ways; + } +} diff --git a/Algorithms/Implementation/Append and Delete/Solution.java b/Algorithms/Implementation/Append and Delete/Solution.java new file mode 100644 index 0000000..888d97d --- /dev/null +++ b/Algorithms/Implementation/Append and Delete/Solution.java @@ -0,0 +1,37 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +// Case 1: See if we can completely erase String "s" and append String "t". If we need to waste operations to reach "k" operations, we can do so when String "s" has no characters. + +// Case 2: See if we can convert String "s" to String "t" without completely erasing String "s". We keep erasing charcters from String "s" until it becomes a prefix of String "t". We then add the characters needed to turn String "s" into String "t". If we need to waste operations to reach "k" operations, we can only do so in groups of 2 by doing an append and a delete. + +public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + String s = scan.next(); + String t = scan.next(); + int k = scan.nextInt(); + scan.close(); + System.out.println(canConvert(s, t, k) ? "Yes" : "No"); + } + + private static boolean canConvert(String s, String t, int k) { + /* Case 1 */ + if (s.length() + t.length() <= k) { + return true; + } + + /* Case 2 */ + int i = 0; // represents index of 1st non-matching character + for ( ; i < s.length() && i < t.length(); i++) { + if (s.charAt(i) != t.charAt(i)) { + break; + } + } + int minOperations = (s.length() - i) + (t.length() - i); + return k >= minOperations && (k - minOperations) % 2 == 0; + } +} diff --git a/Algorithms/Implementation/Beautiful Days at the Movies/Solution.java b/Algorithms/Implementation/Beautiful Days at the Movies/Solution.java new file mode 100644 index 0000000..cd31bc6 --- /dev/null +++ b/Algorithms/Implementation/Beautiful Days at the Movies/Solution.java @@ -0,0 +1,29 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int i = scan.nextInt(); + int j = scan.nextInt(); + int k = scan.nextInt(); + scan.close(); + int count = 0; + for (int num = i; num <= j; num++) { + if (Math.abs(num - reverse(num)) % k == 0) { + count++; + } + } + System.out.println(count); + } + + private static int reverse(int num) { + StringBuilder sb = new StringBuilder(); + sb.append(num); + sb.reverse(); + return Integer.parseInt(sb.toString()); + } +} diff --git a/Algorithms/Implementation/Beautiful Triplets/Solution.java b/Algorithms/Implementation/Beautiful Triplets/Solution.java new file mode 100644 index 0000000..34d61f8 --- /dev/null +++ b/Algorithms/Implementation/Beautiful Triplets/Solution.java @@ -0,0 +1,34 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; +import java.util.HashSet; + +// We are given an increasing input sequence, so no duplicate values exist + +// Time Complexity: O(n) +// Space Complexity: O(n) + +public class Solution { + public static void main(String[] args) { + /* Initialize variables */ + HashSet set = new HashSet<>(); + Scanner scan = new Scanner(System.in); + int size = scan.nextInt(); + int d = scan.nextInt(); + int count = 0; + + /* Solve in 1 pass through values */ + for (int i = 0; i < size; i++) { + int num = scan.nextInt(); + if (set.contains(num - d) && set.contains(num - 2 * d)) { + count++; + } + set.add(num); + } + + scan.close(); + System.out.println(count); + } +} diff --git a/Algorithms/Implementation/Between Two Sets/Solution.java b/Algorithms/Implementation/Between Two Sets/Solution.java new file mode 100644 index 0000000..667d81f --- /dev/null +++ b/Algorithms/Implementation/Between Two Sets/Solution.java @@ -0,0 +1,71 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; +import java.util.Arrays; + +public class Solution { + + public static void main(String[] args) { + /* Read and save input */ + Scanner scan = new Scanner(System.in); + int n = scan.nextInt(); + int m = scan.nextInt(); + int [] arrayA = new int[n]; + for (int i = 0; i < n; i++) { + arrayA[i] = scan.nextInt(); + } + int [] arrayB = new int[m]; + for (int i = 0; i < m; i++) { + arrayB[i] = scan.nextInt(); + } + scan.close(); + + /* Find LCM of arrayA. Find GCD of arrayB */ + int A_LCM = lcm(arrayA); + int B_GCD = gcd(arrayB); + + /* Calculate # of integers "between" arrayA and arrayB */ + int count = (B_GCD % A_LCM == 0) ? numDivisors(B_GCD / A_LCM) : 0; + System.out.println(count); + } + + private static int gcd(int a, int b) { // Euclid's GCD Algorithm + while (b != 0) { + int temp = b; + b = a % b; + a = temp; + } + return a; + } + + private static int lcm(int a, int b) { + return (a * b) / gcd(a, b); + } + + /* Uses Java 8 streams for better parallelization of code */ + private static int gcd(int [] array) { + return Arrays.stream(array).reduce(array[0], (a, b) -> gcd(a, b)); + } + + /* Uses Java 8 streams for better parallelization of code */ + private static int lcm(int [] array) { + return Arrays.stream(array).reduce(array[0], (a, b) -> lcm(a, b)); + } + + private static int numDivisors(int n) { + int count = 0; + int sqrt = (int) Math.sqrt(n); + for (int i = 1; i <= sqrt; i++) { + if (n % i == 0) { // if "i" is a divisor + count += 2; // account for both divisors + } + } + /* If sqrt is a divisor, we should only count it once */ + if (sqrt * sqrt == n) { + count--; + } + return count; + } +} diff --git a/Algorithms/Implementation/Bon Appetit/Solution.java b/Algorithms/Implementation/Bon Appetit/Solution.java new file mode 100644 index 0000000..ec72d0f --- /dev/null +++ b/Algorithms/Implementation/Bon Appetit/Solution.java @@ -0,0 +1,31 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +// Although imprecise, this problem is intended to be solved using an "int" instead of a "double" to store dollar amounts. +public class Solution { + public static void main(String[] args) { + /* Read input and calcute chargedBill and actualBill */ + Scanner scan = new Scanner(System.in); + int n = scan.nextInt(); + int k = scan.nextInt(); + int actualBill = 0; + for (int i = 0; i < n; i++) { + int price = scan.nextInt(); + if (i != k) { + actualBill += price; + } + } + actualBill *= 0.5; + int chargedBill = scan.nextInt(); + + /* Print output */ + if (chargedBill == actualBill) { + System.out.println("Bon Appetit"); + } else { + System.out.println(chargedBill - actualBill); + } + } +} diff --git a/Algorithms/Implementation/Divisible Sum Pairs/Solution.java b/Algorithms/Implementation/Divisible Sum Pairs/Solution.java new file mode 100644 index 0000000..49210b6 --- /dev/null +++ b/Algorithms/Implementation/Divisible Sum Pairs/Solution.java @@ -0,0 +1,48 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +/* + + Runtime: O(n + k) +Space Complexity: O(k) + +We keep track of the mod values in buckets for each number we read. We can do this by creating k buckets where bucket "i" counts each number "n" where n % k = i. + +Notice that each bucket has a corresponding "complement" bucket. That is, if we take the mod value of one bucket and add it to the mod value of another bucket, we get "k". + +Bucket Complement Bucket +------ ----------------- + 0 0 + 1 k-1 + 2 k-2 + 3 k-3 + ... + k-3 3 + k-2 2 + k-1 1 + +As we come across each number, we find its corresponding complement bucket. Each number in this complement bucket can be paired with our original number to create a sum divisible by *k* + +*/ + +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int n = scan.nextInt(); + int k = scan.nextInt(); + + int [] modBucket = new int[k]; + int count = 0; + for (int i = 0; i < n; i++) { + int modValue = scan.nextInt() % k; + count += modBucket[(k - modValue) % k]; // adds # of elements in complement bucket + modBucket[modValue]++; // saves in bucket + } + + scan.close(); + System.out.println(count); + } +} diff --git a/Algorithms/Implementation/Equalize the Array/Solution.java b/Algorithms/Implementation/Equalize the Array/Solution.java new file mode 100644 index 0000000..1187886 --- /dev/null +++ b/Algorithms/Implementation/Equalize the Array/Solution.java @@ -0,0 +1,25 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; +import java.util.Arrays; + +// Runtime: O(n) +// Space Complexity: O(n) +public class Solution { + + private static final int size = 100; + + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int n = scan.nextInt(); + int [] counts = new int[size + 1]; + for (int i = 0; i < n; i++) { + counts[scan.nextInt()]++; + } + scan.close(); + int maxRepetitions = Arrays.stream(counts).max().getAsInt(); + System.out.println(n - maxRepetitions); + } +} diff --git a/Algorithms/Implementation/Extra Long Factorials/Solution.java b/Algorithms/Implementation/Extra Long Factorials/Solution.java new file mode 100644 index 0000000..039c3f7 --- /dev/null +++ b/Algorithms/Implementation/Extra Long Factorials/Solution.java @@ -0,0 +1,24 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; +import java.math.BigInteger; + +public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int n = scan.nextInt(); + scan.close(); + System.out.println(factorial(n)); + } + + private static BigInteger factorial(int n) { + BigInteger result = BigInteger.ONE; + while (n > 1) { + result = result.multiply(BigInteger.valueOf(n)); + n--; + } + return result; + } +} diff --git a/Algorithms/Implementation/Find Digits/Solution.java b/Algorithms/Implementation/Find Digits/Solution.java new file mode 100644 index 0000000..15fe172 --- /dev/null +++ b/Algorithms/Implementation/Find Digits/Solution.java @@ -0,0 +1,30 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int testcases = scan.nextInt(); + while (testcases-- > 0) { + int num = scan.nextInt(); + System.out.println(findDigits(num)); + } + scan.close(); + } + + private static int findDigits(int num) { + int count = 0; + int n = num; + while (n > 0) { + int digit = n % 10; + if (digit != 0 && num % digit == 0) { + count++; + } + n /= 10; + } + return count; + } +} diff --git a/Algorithms/Implementation/Jumping on the Clouds - Revisited/Solution.java b/Algorithms/Implementation/Jumping on the Clouds - Revisited/Solution.java new file mode 100644 index 0000000..99d206e --- /dev/null +++ b/Algorithms/Implementation/Jumping on the Clouds - Revisited/Solution.java @@ -0,0 +1,31 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + int E = 100; + /* Save input */ + Scanner scan = new Scanner(System.in); + int n = scan.nextInt(); + int k = scan.nextInt(); + int cloud[] = new int[n]; + for (int i = 0; i < n; i++) { + cloud[i] = scan.nextInt(); + } + scan.close(); + + /* Jump on clouds */ + int position = 0; + do { + position = (position + k) % n; + if (cloud[position] == 1) { + E -= 2; + } + E--; + } while (position != 0); + System.out.println(E); + } +} diff --git a/Algorithms/Implementation/Jumping on the Clouds/Solution.java b/Algorithms/Implementation/Jumping on the Clouds/Solution.java new file mode 100644 index 0000000..c2eb800 --- /dev/null +++ b/Algorithms/Implementation/Jumping on the Clouds/Solution.java @@ -0,0 +1,31 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + /* Save input */ + Scanner scan = new Scanner(System.in); + int n = scan.nextInt(); + int [] cloud = new int[n]; + for (int i = 0; i < n; i++) { + cloud[i] = scan.nextInt(); + } + scan.close(); + + /* Jump on clouds */ + int jumps = 0; + int i = 0; + while (i < n - 1) { + if (i + 2 < n && cloud[i + 2] == 0) { + i += 2; + } else { + i++; + } + jumps++; + } + System.out.println(jumps); + } +} diff --git a/Algorithms/Implementation/Kangaroo/Solution.java b/Algorithms/Implementation/Kangaroo/Solution.java new file mode 100644 index 0000000..fe9648e --- /dev/null +++ b/Algorithms/Implementation/Kangaroo/Solution.java @@ -0,0 +1,25 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + /* Read and save input */ + Scanner scan = new Scanner(System.in); + int x1 = scan.nextInt(); + int v1 = scan.nextInt(); + int x2 = scan.nextInt(); + int v2 = scan.nextInt(); + scan.close(); + + /* See if kangaroos meet each other */ + if (v1 <= v2) { + System.out.println("NO"); + } else { + boolean kangaroosMeet = (x2 - x1) % (v2 - v1) == 0; + System.out.println(kangaroosMeet ? "YES" : "NO"); + } + } +} diff --git a/Algorithms/Implementation/Library Fine/Solution.java b/Algorithms/Implementation/Library Fine/Solution.java new file mode 100644 index 0000000..b9a944d --- /dev/null +++ b/Algorithms/Implementation/Library Fine/Solution.java @@ -0,0 +1,36 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; +import java.time.LocalDate; + +public class Solution { + public static void main(String[] args) { + /* Read and save input as LocalDates */ + Scanner scan = new Scanner(System.in); + LocalDate returnDate = readDate(scan); + LocalDate expectDate = readDate(scan); + scan.close(); + + /* Calculate fine */ + int fine; + if (returnDate.isEqual(expectDate) || returnDate.isBefore(expectDate)) { + fine = 0; + } else if (returnDate.getMonth() == expectDate.getMonth() && returnDate.getYear() == expectDate.getYear()) { + fine = 15 * (returnDate.getDayOfMonth() - expectDate.getDayOfMonth()); + } else if (returnDate.getYear() == expectDate.getYear()) { + fine = 500 * (returnDate.getMonthValue() - expectDate.getMonthValue()); + } else { + fine = 10000; + } + System.out.println(fine); + } + + private static LocalDate readDate(Scanner scan) { + int day = scan.nextInt(); + int month = scan.nextInt(); + int year = scan.nextInt(); + return LocalDate.of(year, month, day); + } +} diff --git a/Algorithms/Implementation/Manasa and Stones/Solution.java b/Algorithms/Implementation/Manasa and Stones/Solution.java new file mode 100644 index 0000000..ed2c224 --- /dev/null +++ b/Algorithms/Implementation/Manasa and Stones/Solution.java @@ -0,0 +1,42 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +/* + +if (a == b), the last stone can have only 1 value, which is (n - 1) * a + +if (a != b), we notice that 2 consecutive stones can have a difference of "a" or "b". In a path, there are n-1 differences representing pairs of adjacent stones. We are not interested in where in the path the difference between 2 stones is "a" or "b", since changing the order of where the differences occur still results in the same value for the last stone. What's important is the # of times the difference between 2 stones is "a" and the # of times it's "b". For a >= 0 and b >= 0, there are n-1 ways to choose "a" and "b" such that a + b == n-1, so there are n-1 possibilities for the last stone. + +To print the n-1 possible values for the last stone, we iterate through the n-1 combinations of "a" and b" and calculate the value of the last stone for each combination. + +*/ + +// Time complexity: O(n) +// Space complexity: O(1) +public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int T = scan.nextInt(); + while (T-- > 0) { + int n = scan.nextInt(); + int a = scan.nextInt(); + int b = scan.nextInt(); + if (a == b) { + System.out.print((n - 1) * a); + } else { + if (a > b) { // swap to make "a" the smaller value. + int temp = a; + a = b; + b = temp; + } + for (int i = 0; i <= n - 1; i++) { + System.out.print(a*(n-1-i) + b*i + " "); + } + } + System.out.println(); + } + } +} diff --git a/Algorithms/Implementation/Modified Kaprekar Numbers/Solution.java b/Algorithms/Implementation/Modified Kaprekar Numbers/Solution.java new file mode 100644 index 0000000..6e2cb0b --- /dev/null +++ b/Algorithms/Implementation/Modified Kaprekar Numbers/Solution.java @@ -0,0 +1,40 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +// Brute-force solution +public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int p = scan.nextInt(); + int q = scan.nextInt(); + scan.close(); + + boolean foundKaprekar = false; + for (int num = p; num <= q; num++) { + if (isKaprekar(num)) { + foundKaprekar = true; + } + } + if (!foundKaprekar) { + System.out.println("INVALID RANGE"); + } + } + + private static boolean isKaprekar(int num) { + long squared = (long) num * num; // multiplying 2 ints without typecast could cause overflow + String str = String.valueOf(squared); + String left = str.substring(0, str.length() / 2); + String right = str.substring(str.length() / 2); + int numL = (left.isEmpty()) ? 0 : Integer.parseInt(left); + int numR = (right.isEmpty()) ? 0 : Integer.parseInt(right); + if (numL + numR == num) { + System.out.print(num + " "); + return true; + } else { + return false; + } + } +} diff --git a/Algorithms/Implementation/Repeated String/Solution.java b/Algorithms/Implementation/Repeated String/Solution.java new file mode 100644 index 0000000..73e0cfc --- /dev/null +++ b/Algorithms/Implementation/Repeated String/Solution.java @@ -0,0 +1,33 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + /* Save input */ + Scanner scan = new Scanner(System.in); + String str = scan.next(); + long n = scan.nextLong(); + scan.close(); + + /* Found out # of times 'a' appears in our String */ + int wordAs = 0; + for (int i = 0; i < str.length(); i++) { + if (str.charAt(i) == 'a') { + wordAs++; + } + } + long completeWords = n / str.length(); + long remainingLetters = n % str.length(); + long totalAs = completeWords * wordAs; + + for (int i = 0; i < remainingLetters; i++) { + if (str.charAt(i) == 'a') { + totalAs++; + } + } + System.out.println(totalAs); + } +} diff --git a/Algorithms/Implementation/Save the Prisoner!/Solution.java b/Algorithms/Implementation/Save the Prisoner!/Solution.java new file mode 100644 index 0000000..e44bb6b --- /dev/null +++ b/Algorithms/Implementation/Save the Prisoner!/Solution.java @@ -0,0 +1,20 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int T = scan.nextInt(); + while (T-- > 0) { + int N = scan.nextInt(); + int M = scan.nextInt(); + int S = scan.nextInt(); + int last = ((S - 1) + (M - 1)) % N + 1; + System.out.println(last); + } + scan.close(); + } +} diff --git a/Algorithms/Implementation/Sequence Equation/Solution.java b/Algorithms/Implementation/Sequence Equation/Solution.java new file mode 100644 index 0000000..38421ee --- /dev/null +++ b/Algorithms/Implementation/Sequence Equation/Solution.java @@ -0,0 +1,30 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +// - Our input provides us "n" values of x and p(x) +// - p(x) is a 1-to-1 function, so it has an inverse. +// - We create the function representing the inverse of p(x), and represent it as an array: int [] p_inverse +// - We need find a y where p(p(y)) = x. This equation can be rewritten as y = p_inverse(p_inverse(x)), which is the version of the equation we use to calculate and print "y". + +public class Solution { + public static void main(String [] args) { + /* Create function: p_inverse */ + Scanner scan = new Scanner(System.in); + int n = scan.nextInt(); + int [] p_inverse = new int[n + 1]; + for (int x = 1; x <= n; x++) { + int px = scan.nextInt(); + p_inverse[px] = x; + } + scan.close(); + + /* Calculate and print each y */ + for (int x = 1; x <= n; x++) { + int y = p_inverse[p_inverse[x]]; + System.out.println(y); + } + } +} diff --git a/Algorithms/Implementation/Sherlock and Squares/Solution.java b/Algorithms/Implementation/Sherlock and Squares/Solution.java new file mode 100644 index 0000000..4aa183c --- /dev/null +++ b/Algorithms/Implementation/Sherlock and Squares/Solution.java @@ -0,0 +1,20 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +/* Count # of integers (inclusive) between the square roots of A and B */ +public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int T = scan.nextInt(); + while (T-- > 0) { + int A = scan.nextInt(); + int B = scan.nextInt(); + int numSquares = (int) (Math.floor(Math.sqrt(B)) - Math.ceil(Math.sqrt(A)) + 1); + System.out.println(numSquares); + } + scan.close(); + } +} diff --git a/Algorithms/Implementation/Sock Merchant/Solution.java b/Algorithms/Implementation/Sock Merchant/Solution.java new file mode 100644 index 0000000..a0d53b7 --- /dev/null +++ b/Algorithms/Implementation/Sock Merchant/Solution.java @@ -0,0 +1,31 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; +import java.util.HashSet; + +public class Solution { + public static void main(String[] args) { + /* Read some input */ + Scanner scan = new Scanner(System.in); + int n = scan .nextInt(); + + /* Count pairs */ + HashSet set = new HashSet<>(); + int pairs = 0; + for (int i = 0; i < n; i++) { + int cost = scan.nextInt(); + if (set.contains(cost)) { + set.remove(cost); + pairs++; + } else { + set.add(cost); + } + } + + /* Print output */ + scan.close(); + System.out.println(pairs); + } +} diff --git a/Algorithms/Implementation/Taum and B'day/Solution.java b/Algorithms/Implementation/Taum and B'day/Solution.java new file mode 100644 index 0000000..bdb649c --- /dev/null +++ b/Algorithms/Implementation/Taum and B'day/Solution.java @@ -0,0 +1,23 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int T = scan.nextInt(); + while (T-- > 0) { + long B = scan.nextLong(); + long W = scan.nextLong(); + long X = scan.nextLong(); + long Y = scan.nextLong(); + long Z = scan.nextLong(); + long priceB = Math.min(X, Y + Z); // conversion price + long priceW = Math.min(Y, X + Z); // conversion price + System.out.println(B * priceB + W * priceW); + } + scan.close(); + } +} diff --git a/Algorithms/Implementation/The Hurdle Race/Solution.java b/Algorithms/Implementation/The Hurdle Race/Solution.java new file mode 100644 index 0000000..6b3fe0d --- /dev/null +++ b/Algorithms/Implementation/The Hurdle Race/Solution.java @@ -0,0 +1,24 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; +import java.util.Arrays; + +public class Solution { + public static void main(String[] args) { + /* Read and save input */ + Scanner scan = new Scanner(System.in); + int n = scan.nextInt(); + int k = scan.nextInt(); + int [] height = new int[n]; + for (int i = 0; i < n; i++) { + height[i] = scan.nextInt(); + } + scan.close(); + + /* Calculate # of magic beverages needed */ + int maxHeight = Arrays.stream(height).max().getAsInt(); + System.out.println(Math.max(maxHeight - k, 0)); + } +} diff --git a/Algorithms/Implementation/Utopian Tree/Solution.java b/Algorithms/Implementation/Utopian Tree/Solution.java new file mode 100644 index 0000000..23d1648 --- /dev/null +++ b/Algorithms/Implementation/Utopian Tree/Solution.java @@ -0,0 +1,37 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; +import java.util.Arrays; + +// Runtime: O(N + T) +// Space Complexity: O(N + T) +public class Solution { + public static void main(String[] args) { + /* Read and save input */ + Scanner scan = new Scanner(System.in); + int T = scan.nextInt(); + int [] testcase = new int[T]; + for (int i = 0; i < T; i++) { + testcase[i] = scan.nextInt(); + } + + /* Calculate answers for all T testcases */ + int maxCycles = Arrays.stream(testcase).max().getAsInt(); + int [] cache = new int[maxCycles + 1]; + cache[0] = 1; + for (int i = 1; i <= maxCycles; i++) { + if (i % 2 == 1) { + cache[i] = cache[i-1] * 2; + } else { + cache[i] = cache[i-1] + 1; + } + } + + /* Print answers */ + for (int i = 0; i < T; i++) { + System.out.println(cache[testcase[i]]); + } + } +} diff --git a/Algorithms/Implementation/Viral Advertising/Solution.java b/Algorithms/Implementation/Viral Advertising/Solution.java new file mode 100644 index 0000000..39d3f0f --- /dev/null +++ b/Algorithms/Implementation/Viral Advertising/Solution.java @@ -0,0 +1,21 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int n = scan.nextInt(); + scan.close(); + + int people = 2; + int count = 2; + for (int i = 2; i <= n; i++) { + people = (people * 3) / 2; + count += people; + } + System.out.println(count); + } +} diff --git a/Algorithms/README.md b/Algorithms/README.md index 7cf585b..4a3901f 100644 --- a/Algorithms/README.md +++ b/Algorithms/README.md @@ -14,35 +14,38 @@ | Algorithms | Implementation | [Grading Students](https://www.hackerrank.com/challenges/grading) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Grading%20Students/Solution.java) | | Algorithms | Implementation | [Designer PDF Viewer](https://www.hackerrank.com/challenges/designer-pdf-viewer) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Designer%20PDF%20Viewer/Solution.java) | | Algorithms | Implementation | [Apple and Orange](https://www.hackerrank.com/challenges/apple-and-orange) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Apple%20and%20Orange/Solution.java) | -| Algorithms | Implementation | [Kangaroo](https://www.hackerrank.com/challenges/kangaroo) | Easy | Coming Soon! | -| Algorithms | Implementation | [Between Two Sets](https://www.hackerrank.com/challenges/between-two-sets) | Easy | Coming Soon! | -| Algorithms | Implementation | [Divisible Sum Pairs](https://www.hackerrank.com/challenges/divisible-sum-pairs) | Easy | Coming Soon! | -| Algorithms | Implementation | [Bon Appetit](https://www.hackerrank.com/challenges/bon-appetit) | Easy | Coming Soon! | -| Algorithms | Implementation | [Sock Merchant](https://www.hackerrank.com/challenges/sock-merchant) | Easy | Coming Soon! | -| Algorithms | Implementation | [Utopian Tree](https://www.hackerrank.com/challenges/utopian-tree) | Easy | Coming Soon! | +| Algorithms | Implementation | [Kangaroo](https://www.hackerrank.com/challenges/kangaroo) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Kangaroo/Solution.java) | +| Algorithms | Implementation | [Between Two Sets](https://www.hackerrank.com/challenges/between-two-sets) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Between%20Two%20Sets/Solution.java) | +| Algorithms | Implementation | [Divisible Sum Pairs](https://www.hackerrank.com/challenges/divisible-sum-pairs) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Divisible%20Sum%20Pairs/Solution.java) | +| Algorithms | Implementation | [Bon Appetit](https://www.hackerrank.com/challenges/bon-appetit) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Bon%20Appetit/Solution.java) | +| Algorithms | Implementation | [Sock Merchant](https://www.hackerrank.com/challenges/sock-merchant) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Sock%20Merchant/Solution.java) | +| Algorithms | Implementation | [The Hurdle Race](https://www.hackerrank.com/challenges/the-hurdle-race) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/The%20Hurdle%20Race/Solution.java) | +| Algorithms | Implementation | [Utopian Tree](https://www.hackerrank.com/challenges/utopian-tree) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Utopian%20Tree/Solution.java) | | Algorithms | Implementation | [Angry Professor](https://www.hackerrank.com/challenges/angry-professor) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Angry%20Professor/Solution.java) | -| Algorithms | Implementation | [Beautiful Days at the Movies](https://www.hackerrank.com/challenges/beautiful-days-at-the-movies) | Easy | Coming Soon! | -| Algorithms | Implementation | [Viral Advertising](https://www.hackerrank.com/challenges/strange-advertising) | Easy | Coming Soon! | -| Algorithms | Implementation | [Save the Prisoner!](https://www.hackerrank.com/challenges/save-the-prisoner) | Easy | Coming Soon! | +| Algorithms | Implementation | [Beautiful Days at the Movies](https://www.hackerrank.com/challenges/beautiful-days-at-the-movies) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Beautiful%20Days%20at%20the%20Movies/Solution.java) | +| Algorithms | Implementation | [Viral Advertising](https://www.hackerrank.com/challenges/strange-advertising) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Viral%20Advertising/Solution.java) | +| Algorithms | Implementation | [Save the Prisoner!](https://www.hackerrank.com/challenges/save-the-prisoner) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Save%20the%20Prisoner!/Solution.java) | +| Algorithms | Implementation | [Sequence Equation](https://www.hackerrank.com/challenges/permutation-equation) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Sequence%20Equation/Solution.java) | | Algorithms | Implementation | [Circular Array Rotation](https://www.hackerrank.com/challenges/circular-array-rotation) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Circular%20Array%20Rotation/Solution.java) | -| Algorithms | Implementation | [Jumping on the Clouds - Revisited](https://www.hackerrank.com/challenges/jumping-on-the-clouds-revisited) | Easy | Coming Soon! | -| Algorithms | Implementation | [Find Digits](https://www.hackerrank.com/challenges/find-digits) | Easy | Coming Soon! | -| Algorithms | Implementation | [Extra Long Factorials](https://www.hackerrank.com/challenges/extra-long-factorials) | Medium | Coming Soon! | -| Algorithms | Implementation | [Append and Delete](https://www.hackerrank.com/challenges/append-and-delete) | Easy | Coming Soon! | -| Algorithms | Implementation | [Sherlock and Squares](https://www.hackerrank.com/challenges/sherlock-and-squares) | Easy | Coming Soon! | -| Algorithms | Implementation | [Library Fine](https://www.hackerrank.com/challenges/library-fine) | Easy | Coming Soon! | +| Algorithms | Implementation | [Jumping on the Clouds - Revisited](https://www.hackerrank.com/challenges/jumping-on-the-clouds-revisited) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Jumping%20on%20the%20Clouds%20-%20Revisited/Solution.java) | +| Algorithms | Implementation | [Find Digits](https://www.hackerrank.com/challenges/find-digits) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Find%20Digits/Solution.java) | +| Algorithms | Implementation | [Extra Long Factorials](https://www.hackerrank.com/challenges/extra-long-factorials) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Extra%20Long%20Factorials/Solution.java) | +| Algorithms | Implementation | [Append and Delete](https://www.hackerrank.com/challenges/append-and-delete) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Append%20and%20Delete/Solution.java) | +| Algorithms | Implementation | [Sherlock and Squares](https://www.hackerrank.com/challenges/sherlock-and-squares) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Sherlock%20and%20Squares/Solution.java) | +| Algorithms | Implementation | [Library Fine](https://www.hackerrank.com/challenges/library-fine) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Library%20Fine/Solution.java) | | Algorithms | Implementation | [Cut the sticks](https://www.hackerrank.com/challenges/cut-the-sticks) | Easy | Coming Soon! | | Algorithms | Implementation | [Non-Divisible Subset](https://www.hackerrank.com/challenges/non-divisible-subset) | Medium | Coming Soon! | -| Algorithms | Implementation | [Repeated String](https://www.hackerrank.com/challenges/repeated-string) | Easy | Coming Soon! | -| Algorithms | Implementation | [Jumping on the Clouds](https://www.hackerrank.com/challenges/jumping-on-the-clouds) | Easy | Coming Soon! | -| Algorithms | Implementation | [Equalize the Array](https://www.hackerrank.com/challenges/equality-in-a-array) | Easy | Coming Soon! | +| Algorithms | Implementation | [Repeated String](https://www.hackerrank.com/challenges/repeated-string) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Repeated%20String/Solution.java) | +| Algorithms | Implementation | [Jumping on the Clouds](https://www.hackerrank.com/challenges/jumping-on-the-clouds) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Jumping%20on%20the%20Clouds/Solution.java) | +| Algorithms | Implementation | [Equalize the Array](https://www.hackerrank.com/challenges/equality-in-a-array) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Equalize%20the%20Array/Solution.java) | | Algorithms | Implementation | [ACM ICPC Team](https://www.hackerrank.com/challenges/acm-icpc-team) | Easy | Coming Soon! | -| Algorithms | Implementation | [Taum and B'day](https://www.hackerrank.com/challenges/taum-and-bday) | Easy | Coming Soon! | +| Algorithms | Implementation | [Taum and B'day](https://www.hackerrank.com/challenges/taum-and-bday) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Taum%20and%20B%27day/Solution.java) | +| Algorithms | Implementation | [Organizing Containers of Balls](https://www.hackerrank.com/challenges/organizing-containers-of-balls) | Medium | Coming Soon! | | Algorithms | Implementation | [Encryption](https://www.hackerrank.com/challenges/encryption) | Medium | Coming Soon! | | Algorithms | Implementation | [Bigger is Greater](https://www.hackerrank.com/challenges/bigger-is-greater) | Medium | Coming Soon! | -| Algorithms | Implementation | [Modified Kaprekar Numbers](https://www.hackerrank.com/challenges/kaprekar-numbers) | Easy | Coming Soon! | -| Algorithms | Implementation | [Beautiful Triplets](https://www.hackerrank.com/challenges/beautiful-triplets) | Easy | Coming Soon! | -| Algorithms | Implementation | [Manasa and Stones](https://www.hackerrank.com/challenges/manasa-and-stones) | Easy | Coming Soon! | +| Algorithms | Implementation | [Modified Kaprekar Numbers](https://www.hackerrank.com/challenges/kaprekar-numbers) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Modified%20Kaprekar%20Numbers/Solution.java) | +| Algorithms | Implementation | [Beautiful Triplets](https://www.hackerrank.com/challenges/beautiful-triplets) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Beautiful%20Triplets/Solution.java) | +| Algorithms | Implementation | [Manasa and Stones](https://www.hackerrank.com/challenges/manasa-and-stones) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Manasa%20and%20Stones/Solution.java) | | Algorithms | Implementation | [Minimum Distances](https://www.hackerrank.com/challenges/minimum-distances) | Easy | Coming Soon! | | Algorithms | Implementation | [The Time in Words](https://www.hackerrank.com/challenges/the-time-in-words) | Medium | Coming Soon! | | Algorithms | Implementation | [Cavity Map](https://www.hackerrank.com/challenges/cavity-map) | Easy | Coming Soon! | @@ -210,7 +213,7 @@ | Algorithms | Greedy | [Accessory Collection](https://www.hackerrank.com/challenges/accessory-collection) | Hard | Coming Soon! | | Algorithms | Greedy | [Team Formation](https://www.hackerrank.com/challenges/team-formation) | Advanced | Coming Soon! | | Algorithms | Greedy | [Fighting Pits](https://www.hackerrank.com/challenges/fighting-pits) | Hard | Coming Soon! | -| Algorithms | Dynamic Programming | [The Coin Change Problem](https://www.hackerrank.com/challenges/coin-change) | Hard | Coming Soon! | +| Algorithms | Dynamic Programming | [The Coin Change Problem](https://www.hackerrank.com/challenges/coin-change) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Dynamic%20Programming/The%20Coin%20Change%20Problem/Solution.java) | | Algorithms | Dynamic Programming | [Equal](https://www.hackerrank.com/challenges/equal) | Medium | Coming Soon! | | Algorithms | Dynamic Programming | [Sherlock and Cost](https://www.hackerrank.com/challenges/sherlock-and-cost) | Medium | Coming Soon! | | Algorithms | Dynamic Programming | [Vertical Sticks](https://www.hackerrank.com/challenges/vertical-sticks) | Medium | Coming Soon! | @@ -336,7 +339,7 @@ | Algorithms | Game Theory | [Tower Breakers](https://www.hackerrank.com/challenges/tower-breakers-1) | Easy | Coming Soon! | | Algorithms | Game Theory | [A Chessboard Game](https://www.hackerrank.com/challenges/a-chessboard-game-1) | Easy | Coming Soon! | | Algorithms | Game Theory | [Introduction to Nim Game](https://www.hackerrank.com/challenges/nim-game-1) | Easy | Coming Soon! | -| Algorithms | Game Theory | [MisĨre Nim](https://www.hackerrank.com/challenges/misere-nim-1) | Easy | Coming Soon! | +| Algorithms | Game Theory | [Misere Nim](https://www.hackerrank.com/challenges/misere-nim-1) | Easy | Coming Soon! | | Algorithms | Game Theory | [Nimble Game](https://www.hackerrank.com/challenges/nimble-game-1) | Easy | Coming Soon! | | Algorithms | Game Theory | [Poker Nim](https://www.hackerrank.com/challenges/poker-nim-1) | Easy | Coming Soon! | | Algorithms | Game Theory | [Tower Breakers, Revisited!](https://www.hackerrank.com/challenges/tower-breakers-revisited-1) | Medium | Coming Soon! | diff --git a/Algorithms/Search/Ice Cream Parlor/Solution.java b/Algorithms/Search/Ice Cream Parlor/Solution.java index 14c44b4..815ae30 100644 --- a/Algorithms/Search/Ice Cream Parlor/Solution.java +++ b/Algorithms/Search/Ice Cream Parlor/Solution.java @@ -5,9 +5,24 @@ import java.util.Scanner; import java.util.HashMap; -/* Runtime: O(n) using HashMap */ +// Runtime: O(n) using HashMap public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int t = scan.nextInt(); + while (t-- > 0) { + int m = scan.nextInt(); + int n = scan.nextInt(); + int costs [] = new int[n]; + for (int i = 0; i < n; i++) { + costs[i] = scan.nextInt(); + } + buyIceCream(costs, m); + } + scan.close(); + } + public static void buyIceCream(int [] costs, int money) { HashMap map = new HashMap<>(); // key = cost, value = ice cream ID @@ -27,20 +42,4 @@ public class Solution { } } } - - public static void main(String[] args) { - Scanner scan = new Scanner(System.in); - int t = scan.nextInt(); - for(int a0 = 0; a0 < t; a0++){ - int m = scan.nextInt(); - int n = scan.nextInt(); - int a[] = new int[n]; - for(int a_i=0; a_i < n; a_i++) { - a[a_i] = scan.nextInt(); - } - - buyIceCream(a, m); - } - scan.close(); - } } diff --git a/Algorithms/Warmup/Plus Minus/Solution.java b/Algorithms/Warmup/Plus Minus/Solution.java index 0f1871c..d7cdb6b 100644 --- a/Algorithms/Warmup/Plus Minus/Solution.java +++ b/Algorithms/Warmup/Plus Minus/Solution.java @@ -4,14 +4,13 @@ import java.util.Scanner; -/* O(n) runtime, O(1) space */ +// Runtime: O(n) +// Space Complexity: O(1) public class Solution { public static void main(String[] args) { - /* Get size */ Scanner scan = new Scanner(System.in); int size = scan.nextInt(); - /* Count instances of +/-/0 */ double positives = 0; double negatives = 0; double zeroes = 0; @@ -27,7 +26,6 @@ public class Solution { } scan.close(); - /* Print ratios */ System.out.println(positives / size); System.out.println(negatives / size); System.out.println(zeroes / size); diff --git a/Cracking the Coding Interview/Algorithms/Binary Search - Ice Cream Parlor/Solution.java b/Cracking the Coding Interview/Algorithms/Binary Search - Ice Cream Parlor/Solution.java index 14c44b4..815ae30 100644 --- a/Cracking the Coding Interview/Algorithms/Binary Search - Ice Cream Parlor/Solution.java +++ b/Cracking the Coding Interview/Algorithms/Binary Search - Ice Cream Parlor/Solution.java @@ -5,9 +5,24 @@ import java.util.Scanner; import java.util.HashMap; -/* Runtime: O(n) using HashMap */ +// Runtime: O(n) using HashMap public class Solution { + public static void main(String[] args) { + Scanner scan = new Scanner(System.in); + int t = scan.nextInt(); + while (t-- > 0) { + int m = scan.nextInt(); + int n = scan.nextInt(); + int costs [] = new int[n]; + for (int i = 0; i < n; i++) { + costs[i] = scan.nextInt(); + } + buyIceCream(costs, m); + } + scan.close(); + } + public static void buyIceCream(int [] costs, int money) { HashMap map = new HashMap<>(); // key = cost, value = ice cream ID @@ -27,20 +42,4 @@ public class Solution { } } } - - public static void main(String[] args) { - Scanner scan = new Scanner(System.in); - int t = scan.nextInt(); - for(int a0 = 0; a0 < t; a0++){ - int m = scan.nextInt(); - int n = scan.nextInt(); - int a[] = new int[n]; - for(int a_i=0; a_i < n; a_i++) { - a[a_i] = scan.nextInt(); - } - - buyIceCream(a, m); - } - scan.close(); - } } diff --git a/Data Structures/Multiple Choice/Data Structures MCQ 1/Solution.txt b/Data Structures/Multiple Choice/Data Structures MCQ 1/Solution.txt new file mode 100644 index 0000000..78336b4 --- /dev/null +++ b/Data Structures/Multiple Choice/Data Structures MCQ 1/Solution.txt @@ -0,0 +1,18 @@ + Author: Rodney Shaghoulian + Github: github.com/rshaghoulian +HackerRank: hackerrank.com/rshaghoulian + + +Answer: n-1 + +A tree with 1 node has 0 edges. For each node we connect to the tree, we must connect it using 1 additional edge. + +# of nodes # of edges +---------- ---------- + 1 0 + 2 1 + 3 2 + 4 3 + 5 4 + 6 5 + n n-1 diff --git a/Data Structures/Multiple Choice/Data Structures MCQ 2/Solution.txt b/Data Structures/Multiple Choice/Data Structures MCQ 2/Solution.txt new file mode 100644 index 0000000..131024c --- /dev/null +++ b/Data Structures/Multiple Choice/Data Structures MCQ 2/Solution.txt @@ -0,0 +1,11 @@ + Author: Rodney Shaghoulian + Github: github.com/rshaghoulian +HackerRank: hackerrank.com/rshaghoulian + + +Answer: Segment Tree + +By "updates" they mean inserting/deleting an element in the data structure. +By "queries" they mean searching for a specific element. + +Notice that a segment tree (assuming it's balanced) will have height = log n. Whether we do an insert, delete, or query, we start from the root and decide to go left or right at each node/level in the tree. We have to make (log n) of these decisions since that is the height of the segment tree. \ No newline at end of file diff --git a/Data Structures/Multiple Choice/Data Structures MCQ 3/Solution.txt b/Data Structures/Multiple Choice/Data Structures MCQ 3/Solution.txt new file mode 100644 index 0000000..41c69de --- /dev/null +++ b/Data Structures/Multiple Choice/Data Structures MCQ 3/Solution.txt @@ -0,0 +1,10 @@ + Author: Rodney Shaghoulian + Github: github.com/rshaghoulian +HackerRank: hackerrank.com/rshaghoulian + + +Answer: Stack + +- A Queue is FIFO = First In First Out +- A Stack is LIFO = Last In First Out +- An array or vector aren't exactly applicable here. \ No newline at end of file diff --git a/Data Structures/README.md b/Data Structures/README.md index b3bbdf3..485ac6a 100644 --- a/Data Structures/README.md +++ b/Data Structures/README.md @@ -1,111 +1,111 @@ ## Data Structures -| Domain | Subdomain | Challenge | Difficulty | Solution | -|:---------------:|:---------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| -| Data Structures | Arrays | [Arrays - DS](https://www.hackerrank.com/challenges/arrays-ds) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Arrays%20-%20DS/Solution.java) | -| Data Structures | Arrays | [2D Array - DS](https://www.hackerrank.com/challenges/2d-array) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/2D%20Array%20-%20DS/Solution.java) | -| Data Structures | Arrays | [Dynamic Array](https://www.hackerrank.com/challenges/dynamic-array) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Dynamic%20Array/Solution.java) | -| Data Structures | Arrays | [Left Rotation](https://www.hackerrank.com/challenges/array-left-rotation) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Left%20Rotation/Solution.java) | -| Data Structures | Arrays | [Sparse Arrays](https://www.hackerrank.com/challenges/sparse-arrays) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Sparse%20Arrays/Solution.java) | -| Data Structures | Arrays | [Algorithmic Crush](https://www.hackerrank.com/challenges/crush) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Algorithmic%20Crush/Solution.java) | -| Data Structures | Linked List | [Print the Elements of a Linked List](https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Print%20the%20Elements%20of%20a%20Linked%20List/Solution.java) | -| Data Structures | Linked List | [Insert a Node at the Tail of a Linked List](https://www.hackerrank.com/challenges/insert-a-node-at-the-tail-of-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Insert%20a%20Node%20at%20the%20Tail%20of%20a%20Linked%20List/Solution.java) | -| Data Structures | Linked List | [Insert a node at the head of a linked list](https://www.hackerrank.com/challenges/insert-a-node-at-the-head-of-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Insert%20a%20node%20at%20the%20head%20of%20a%20linked%20list/Solution.java) | -| Data Structures | Linked List | [Insert a node at a specific position in a linked list](https://www.hackerrank.com/challenges/insert-a-node-at-a-specific-position-in-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Insert%20a%20node%20at%20a%20specific%20position%20in%20a%20linked%20list/Solution.java) | -| Data Structures | Linked List | [Delete a Node](https://www.hackerrank.com/challenges/delete-a-node-from-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Delete%20a%20Node/Solution.java) | -| Data Structures | Linked List | [Print in Reverse](https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list-in-reverse) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Print%20in%20Reverse/Solution.java) | -| Data Structures | Linked List | [Reverse a linked list](https://www.hackerrank.com/challenges/reverse-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Reverse%20a%20linked%20list/Solution.java) | -| Data Structures | Linked List | [Compare two linked lists](https://www.hackerrank.com/challenges/compare-two-linked-lists) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Compare%20two%20linked%20lists/Solution.java) | -| Data Structures | Linked List | [Merge two sorted linked lists](https://www.hackerrank.com/challenges/merge-two-sorted-linked-lists) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Merge%20two%20sorted%20linked%20lists/Solution.java) | -| Data Structures | Linked List | [Get Node Value](https://www.hackerrank.com/challenges/get-the-value-of-the-node-at-a-specific-position-from-the-tail) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Get%20Node%20Value/Solution.java) | -| Data Structures | Linked List | [Delete duplicate-value nodes from a sorted linked list](https://www.hackerrank.com/challenges/delete-duplicate-value-nodes-from-a-sorted-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Delete%20duplicate-value%20nodes%20from%20a%20sorted%20linked%20list/Solution.java) | -| Data Structures | Linked List | [Cycle Detection](https://www.hackerrank.com/challenges/detect-whether-a-linked-list-contains-a-cycle) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Cycle%20Detection/Solution.java) | -| Data Structures | Linked List | [Find Merge Point of Two Lists](https://www.hackerrank.com/challenges/find-the-merge-point-of-two-joined-linked-lists) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Find%20Merge%20Point%20of%20Two%20Lists/Solution.java) | -| Data Structures | Linked List | [Inserting a Node Into a Sorted Doubly Linked List](https://www.hackerrank.com/challenges/insert-a-node-into-a-sorted-doubly-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Inserting%20a%20Node%20Into%20a%20Sorted%20Doubly%20Linked%20List/Solution.java) | -| Data Structures | Linked List | [Reverse a doubly linked list](https://www.hackerrank.com/challenges/reverse-a-doubly-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Reverse%20a%20doubly%20linked%20list/Solution.java) | -| Data Structures | Trees | [Tree: Preorder Traversal](https://www.hackerrank.com/challenges/tree-preorder-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Preorder%20Traversal/Solution.java) | -| Data Structures | Trees | [Tree: Postorder Traversal](https://www.hackerrank.com/challenges/tree-postorder-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Postorder%20Traversal/Solution.java) | -| Data Structures | Trees | [Tree: Inorder Traversal](https://www.hackerrank.com/challenges/tree-inorder-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Inorder%20Traversal/Solution.java) | -| Data Structures | Trees | [Tree: Height of a Binary Tree](https://www.hackerrank.com/challenges/tree-height-of-a-binary-tree) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Height%20of%20a%20Binary%20Tree/Solution.java) | -| Data Structures | Trees | [Tree: Top View](https://www.hackerrank.com/challenges/tree-top-view) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Top%20View/Solution.java) | -| Data Structures | Trees | [Tree: Level Order Traversal](https://www.hackerrank.com/challenges/tree-level-order-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Level%20Order%20Traversal/Solution.java) | -| Data Structures | Trees | [Binary Search Tree: Insertion](https://www.hackerrank.com/challenges/binary-search-tree-insertion) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Binary%20Search%20Tree%20-%20Insertion/Solution.java) | -| Data Structures | Trees | [Tree: Huffman Decoding](https://www.hackerrank.com/challenges/tree-huffman-decoding) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Huffman%20Decoding/Solution.java) | -| Data Structures | Trees | [Binary Search Tree: Lowest Common Ancestor](https://www.hackerrank.com/challenges/binary-search-tree-lowest-common-ancestor) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Binary%20Search%20Tree%20-%20Lowest%20Common%20Ancestor/Solution.java) | -| Data Structures | Trees | [Swap Nodes [Algo]](https://www.hackerrank.com/challenges/swap-nodes-algo) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Swap%20Nodes%20%5BAlgo%5D/Solution.java) | -| Data Structures | Trees | [Is This a Binary Search Tree?](https://www.hackerrank.com/challenges/is-binary-search-tree) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Is%20This%20a%20Binary%20Search%20Tree/Solution.java) | -| Data Structures | Trees | [Square-Ten Tree](https://www.hackerrank.com/challenges/square-ten-tree) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Square-Ten%20Tree/Solution.java) | -| Data Structures | Trees | [Balanced Forest](https://www.hackerrank.com/challenges/balanced-forest) | Hard | Coming Soon! | -| Data Structures | Balanced Trees | [Self Balancing Tree](https://www.hackerrank.com/challenges/self-balancing-tree) | Medium | Coming Soon! | -| Data Structures | Balanced Trees | [Array and simple queries](https://www.hackerrank.com/challenges/array-and-simple-queries) | Hard | Coming Soon! | -| Data Structures | Balanced Trees | [Median Updates](https://www.hackerrank.com/challenges/median) | Hard | Coming Soon! | -| Data Structures | Stacks | [Maximum Element](https://www.hackerrank.com/challenges/maximum-element) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Stacks/Maximum%20Element/Solution.java) | -| Data Structures | Stacks | [Balanced Brackets](https://www.hackerrank.com/challenges/balanced-brackets) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Stacks/Balanced%20Brackets/Solution.java) | -| Data Structures | Stacks | [Largest Rectangle](https://www.hackerrank.com/challenges/largest-rectangle) | Hard | Coming Soon! | -| Data Structures | Stacks | [Simple Text Editor](https://www.hackerrank.com/challenges/simple-text-editor) | Medium | Coming Soon! | -| Data Structures | Stacks | [Equal Stacks](https://www.hackerrank.com/challenges/equal-stacks) | Easy | Coming Soon! | -| Data Structures | Stacks | [Poisonous Plants](https://www.hackerrank.com/challenges/poisonous-plants) | Hard | Coming Soon! | -| Data Structures | Stacks | [AND xor OR](https://www.hackerrank.com/challenges/and-xor-or) | Hard | Coming Soon! | -| Data Structures | Stacks | [Waiter](https://www.hackerrank.com/challenges/waiter) | Medium | Coming Soon! | -| Data Structures | Queues | [Queue using Two Stacks](https://www.hackerrank.com/challenges/queue-using-two-stacks) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Queues/Queue%20using%20Two%20Stacks/Solution.java) | -| Data Structures | Queues | [Castle on the Grid](https://www.hackerrank.com/challenges/castle-on-the-grid) | Medium | Coming Soon! | -| Data Structures | Queues | [Down to Zero II](https://www.hackerrank.com/challenges/down-to-zero-ii) | Medium | Coming Soon! | -| Data Structures | Queues | [Truck Tour](https://www.hackerrank.com/challenges/truck-tour) | Hard | Coming Soon! | -| Data Structures | Queues | [Queries with Fixed Length](https://www.hackerrank.com/challenges/queries-with-fixed-length) | Hard | Coming Soon! | -| Data Structures | Heap | [QHEAP1](https://www.hackerrank.com/challenges/qheap1) | Easy | Coming Soon! | -| Data Structures | Heap | [Jesse and Cookies](https://www.hackerrank.com/challenges/jesse-and-cookies) | Easy | Coming Soon! | -| Data Structures | Heap | [Find the Running Median](https://www.hackerrank.com/challenges/find-the-running-median) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Heap/Find%20the%20Running%20Median/Solution.java) | -| Data Structures | Heap | [Minimum Average Waiting Time](https://www.hackerrank.com/challenges/minimum-average-waiting-time) | Hard | Coming Soon! | -| Data Structures | Disjoint Set | [Merging Communities](https://www.hackerrank.com/challenges/merging-communities) | Hard | Coming Soon! | -| Data Structures | Disjoint Set | [Components in a graph](https://www.hackerrank.com/challenges/components-in-graph) | Medium | Coming Soon! | -| Data Structures | Disjoint Set | [Kundu and Tree](https://www.hackerrank.com/challenges/kundu-and-tree) | Hard | Coming Soon! | -| Data Structures | Disjoint Set | [Super Maximum Cost Queries](https://www.hackerrank.com/challenges/maximum-cost-queries) | Hard | Coming Soon! | -| Data Structures | Multiple Choice | [Data Structures MCQ 1](https://www.hackerrank.com/challenges/how-well-do-you-know-trees) | Multiple Choice | Coming Soon! | -| Data Structures | Multiple Choice | [Data Structures MCQ 2](https://www.hackerrank.com/challenges/are-you-an-expert-on-data-structures) | Multiple Choice | Coming Soon! | -| Data Structures | Multiple Choice | [Data Structures MCQ 3](https://www.hackerrank.com/challenges/are-you-an-expert-on-data-structures-1) | Multiple Choice | Coming Soon! | -| Data Structures | Trie | [Contacts](https://www.hackerrank.com/challenges/contacts) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trie/Contacts/Solution.java) | -| Data Structures | Trie | [No Prefix Set](https://www.hackerrank.com/challenges/no-prefix-set) | Hard | Coming Soon! | -| Data Structures | Advanced | [Kindergarten Adventures](https://www.hackerrank.com/challenges/kindergarten-adventures) | Medium | Coming Soon! | -| Data Structures | Advanced | [Cube Summation](https://www.hackerrank.com/challenges/cube-summation) | Hard | Coming Soon! | -| Data Structures | Advanced | [Mr. X and His Shots](https://www.hackerrank.com/challenges/x-and-his-shots) | Medium | Coming Soon! | -| Data Structures | Advanced | [Direct Connections](https://www.hackerrank.com/challenges/direct-connections) | Hard | Coming Soon! | -| Data Structures | Advanced | [Subsequence Weighting](https://www.hackerrank.com/challenges/subsequence-weighting) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Jim and the Skyscrapers](https://www.hackerrank.com/challenges/jim-and-the-skyscrapers) | Medium | Coming Soon! | -| Data Structures | Advanced | [Counting On a Tree](https://www.hackerrank.com/challenges/counting-on-a-tree) | Expert | Coming Soon! | -| Data Structures | Advanced | [Unique Colors](https://www.hackerrank.com/challenges/unique-colors) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Self-Driving Bus](https://www.hackerrank.com/challenges/self-driving-bus) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Fibonacci Numbers Tree](https://www.hackerrank.com/challenges/fibonacci-numbers-tree) | Expert | Coming Soon! | -| Data Structures | Advanced | [Functional Palindromes](https://www.hackerrank.com/challenges/functional-palindromes) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Lazy White Falcon](https://www.hackerrank.com/challenges/lazy-white-falcon) | Hard | Coming Soon! | -| Data Structures | Advanced | [Ticket to Ride](https://www.hackerrank.com/challenges/ticket-to-ride) | Expert | Coming Soon! | -| Data Structures | Advanced | [Heavy Light White Falcon](https://www.hackerrank.com/challenges/heavy-light-white-falcon) | Hard | Coming Soon! | -| Data Structures | Advanced | [Sum of the Maximums](https://www.hackerrank.com/challenges/little-alexey-and-sum-of-maximums) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Heavy Light 2 White Falcon](https://www.hackerrank.com/challenges/heavy-light-2-white-falcon) | Hard | Coming Soon! | -| Data Structures | Advanced | [Library Query](https://www.hackerrank.com/challenges/library-query) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Starfleet](https://www.hackerrank.com/challenges/starfleet) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Almost Equal - Advanced](https://www.hackerrank.com/challenges/almost-equal-advanced) | Expert | Coming Soon! | -| Data Structures | Advanced | [Almost sorted interval](https://www.hackerrank.com/challenges/almost-sorted-interval) | Expert | Coming Soon! | -| Data Structures | Advanced | [Burger Happiness](https://www.hackerrank.com/challenges/burger-happiness) | Hard | Coming Soon! | -| Data Structures | Advanced | [Roy and alpha-beta trees](https://www.hackerrank.com/challenges/roy-and-alpha-beta-trees) | Hard | Coming Soon! | -| Data Structures | Advanced | [Coloring Tree](https://www.hackerrank.com/challenges/coloring-tree) | Hard | Coming Soon! | -| Data Structures | Advanced | [Recalling Early Days GP with Trees](https://www.hackerrank.com/challenges/recalling-early-days-gp-with-trees) | Hard | Coming Soon! | -| Data Structures | Advanced | [Swaps and Sum](https://www.hackerrank.com/challenges/swaps-and-sum) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Arithmetic Progressions](https://www.hackerrank.com/challenges/arithmetic-progressions) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Coolguy and Two Subsequences](https://www.hackerrank.com/challenges/coolguy-and-two-subsequences) | Advanced | Coming Soon! | -| Data Structures | Advanced | [White Falcon And Tree](https://www.hackerrank.com/challenges/white-falcon-and-tree) | Hard | Coming Soon! | -| Data Structures | Advanced | [Subtrees And Paths](https://www.hackerrank.com/challenges/subtrees-and-paths) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Triplets](https://www.hackerrank.com/challenges/triplets) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Beautiful Segments](https://www.hackerrank.com/challenges/beautiful-segments) | Expert | Coming Soon! | -| Data Structures | Advanced | [Divisibility](https://www.hackerrank.com/challenges/ab0) | Expert | Coming Soon! | -| Data Structures | Advanced | [BST maintenance](https://www.hackerrank.com/challenges/bst-maintenance) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Find Maximum Index Product](https://www.hackerrank.com/challenges/find-maximum-index-product) | Medium | Coming Soon! | -| Data Structures | Advanced | [Taxicab Driver's Problem](https://www.hackerrank.com/challenges/taxicab-drivers-problem) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Jaggu Playing with Balloons](https://www.hackerrank.com/challenges/jagia-playing-with-numbers) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Dynamic Summation](https://www.hackerrank.com/challenges/dynamic-summation) | Hard | Coming Soon! | -| Data Structures | Advanced | [Two Array Problem](https://www.hackerrank.com/challenges/weird-queries) | Hard | Coming Soon! | -| Data Structures | Advanced | [Rooted Tree](https://www.hackerrank.com/challenges/rooted-tree) | Hard | Coming Soon! | -| Data Structures | Advanced | [The crazy helix](https://www.hackerrank.com/challenges/helix) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Network administration](https://www.hackerrank.com/challenges/net-admin) | Hard | Coming Soon! | -| Data Structures | Advanced | [Easy Addition](https://www.hackerrank.com/challenges/easy-addition) | Expert | Coming Soon! | -| Data Structures | Advanced | [Find the permutation](https://www.hackerrank.com/challenges/find-the-permutation) | Expert | Coming Soon! | -| Data Structures | Advanced | [Company Retreat](https://www.hackerrank.com/challenges/company-retreat) | Advanced | Coming Soon! | +| Domain | Subdomain | Challenge | Difficulty | Solution | +|:---------------:|:---------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| +| Data Structures | Arrays | [Arrays - DS](https://www.hackerrank.com/challenges/arrays-ds) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Arrays%20-%20DS/Solution.java) | +| Data Structures | Arrays | [2D Array - DS](https://www.hackerrank.com/challenges/2d-array) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/2D%20Array%20-%20DS/Solution.java) | +| Data Structures | Arrays | [Dynamic Array](https://www.hackerrank.com/challenges/dynamic-array) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Dynamic%20Array/Solution.java) | +| Data Structures | Arrays | [Left Rotation](https://www.hackerrank.com/challenges/array-left-rotation) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Left%20Rotation/Solution.java) | +| Data Structures | Arrays | [Sparse Arrays](https://www.hackerrank.com/challenges/sparse-arrays) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Sparse%20Arrays/Solution.java) | +| Data Structures | Arrays | [Algorithmic Crush](https://www.hackerrank.com/challenges/crush) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Algorithmic%20Crush/Solution.java) | +| Data Structures | Linked List | [Print the Elements of a Linked List](https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Print%20the%20Elements%20of%20a%20Linked%20List/Solution.java) | +| Data Structures | Linked List | [Insert a Node at the Tail of a Linked List](https://www.hackerrank.com/challenges/insert-a-node-at-the-tail-of-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Insert%20a%20Node%20at%20the%20Tail%20of%20a%20Linked%20List/Solution.java) | +| Data Structures | Linked List | [Insert a node at the head of a linked list](https://www.hackerrank.com/challenges/insert-a-node-at-the-head-of-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Insert%20a%20node%20at%20the%20head%20of%20a%20linked%20list/Solution.java) | +| Data Structures | Linked List | [Insert a node at a specific position in a linked list](https://www.hackerrank.com/challenges/insert-a-node-at-a-specific-position-in-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Insert%20a%20node%20at%20a%20specific%20position%20in%20a%20linked%20list/Solution.java) | +| Data Structures | Linked List | [Delete a Node](https://www.hackerrank.com/challenges/delete-a-node-from-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Delete%20a%20Node/Solution.java) | +| Data Structures | Linked List | [Print in Reverse](https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list-in-reverse) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Print%20in%20Reverse/Solution.java) | +| Data Structures | Linked List | [Reverse a linked list](https://www.hackerrank.com/challenges/reverse-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Reverse%20a%20linked%20list/Solution.java) | +| Data Structures | Linked List | [Compare two linked lists](https://www.hackerrank.com/challenges/compare-two-linked-lists) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Compare%20two%20linked%20lists/Solution.java) | +| Data Structures | Linked List | [Merge two sorted linked lists](https://www.hackerrank.com/challenges/merge-two-sorted-linked-lists) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Merge%20two%20sorted%20linked%20lists/Solution.java) | +| Data Structures | Linked List | [Get Node Value](https://www.hackerrank.com/challenges/get-the-value-of-the-node-at-a-specific-position-from-the-tail) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Get%20Node%20Value/Solution.java) | +| Data Structures | Linked List | [Delete duplicate-value nodes from a sorted linked list](https://www.hackerrank.com/challenges/delete-duplicate-value-nodes-from-a-sorted-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Delete%20duplicate-value%20nodes%20from%20a%20sorted%20linked%20list/Solution.java) | +| Data Structures | Linked List | [Cycle Detection](https://www.hackerrank.com/challenges/detect-whether-a-linked-list-contains-a-cycle) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Cycle%20Detection/Solution.java) | +| Data Structures | Linked List | [Find Merge Point of Two Lists](https://www.hackerrank.com/challenges/find-the-merge-point-of-two-joined-linked-lists) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Find%20Merge%20Point%20of%20Two%20Lists/Solution.java) | +| Data Structures | Linked List | [Inserting a Node Into a Sorted Doubly Linked List](https://www.hackerrank.com/challenges/insert-a-node-into-a-sorted-doubly-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Inserting%20a%20Node%20Into%20a%20Sorted%20Doubly%20Linked%20List/Solution.java) | +| Data Structures | Linked List | [Reverse a doubly linked list](https://www.hackerrank.com/challenges/reverse-a-doubly-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Reverse%20a%20doubly%20linked%20list/Solution.java) | +| Data Structures | Trees | [Tree: Preorder Traversal](https://www.hackerrank.com/challenges/tree-preorder-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Preorder%20Traversal/Solution.java) | +| Data Structures | Trees | [Tree: Postorder Traversal](https://www.hackerrank.com/challenges/tree-postorder-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Postorder%20Traversal/Solution.java) | +| Data Structures | Trees | [Tree: Inorder Traversal](https://www.hackerrank.com/challenges/tree-inorder-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Inorder%20Traversal/Solution.java) | +| Data Structures | Trees | [Tree: Height of a Binary Tree](https://www.hackerrank.com/challenges/tree-height-of-a-binary-tree) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Height%20of%20a%20Binary%20Tree/Solution.java) | +| Data Structures | Trees | [Tree: Top View](https://www.hackerrank.com/challenges/tree-top-view) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Top%20View/Solution.java) | +| Data Structures | Trees | [Tree: Level Order Traversal](https://www.hackerrank.com/challenges/tree-level-order-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Level%20Order%20Traversal/Solution.java) | +| Data Structures | Trees | [Binary Search Tree: Insertion](https://www.hackerrank.com/challenges/binary-search-tree-insertion) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Binary%20Search%20Tree%20-%20Insertion/Solution.java) | +| Data Structures | Trees | [Tree: Huffman Decoding](https://www.hackerrank.com/challenges/tree-huffman-decoding) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Huffman%20Decoding/Solution.java) | +| Data Structures | Trees | [Binary Search Tree: Lowest Common Ancestor](https://www.hackerrank.com/challenges/binary-search-tree-lowest-common-ancestor) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Binary%20Search%20Tree%20-%20Lowest%20Common%20Ancestor/Solution.java) | +| Data Structures | Trees | [Swap Nodes [Algo]](https://www.hackerrank.com/challenges/swap-nodes-algo) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Swap%20Nodes%20%5BAlgo%5D/Solution.java) | +| Data Structures | Trees | [Is This a Binary Search Tree?](https://www.hackerrank.com/challenges/is-binary-search-tree) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Is%20This%20a%20Binary%20Search%20Tree/Solution.java) | +| Data Structures | Trees | [Square-Ten Tree](https://www.hackerrank.com/challenges/square-ten-tree) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Square-Ten%20Tree/Solution.java) | +| Data Structures | Trees | [Balanced Forest](https://www.hackerrank.com/challenges/balanced-forest) | Hard | Coming Soon! | +| Data Structures | Balanced Trees | [Self Balancing Tree](https://www.hackerrank.com/challenges/self-balancing-tree) | Medium | Coming Soon! | +| Data Structures | Balanced Trees | [Array and simple queries](https://www.hackerrank.com/challenges/array-and-simple-queries) | Hard | Coming Soon! | +| Data Structures | Balanced Trees | [Median Updates](https://www.hackerrank.com/challenges/median) | Hard | Coming Soon! | +| Data Structures | Stacks | [Maximum Element](https://www.hackerrank.com/challenges/maximum-element) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Stacks/Maximum%20Element/Solution.java) | +| Data Structures | Stacks | [Balanced Brackets](https://www.hackerrank.com/challenges/balanced-brackets) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Stacks/Balanced%20Brackets/Solution.java) | +| Data Structures | Stacks | [Largest Rectangle](https://www.hackerrank.com/challenges/largest-rectangle) | Hard | Coming Soon! | +| Data Structures | Stacks | [Simple Text Editor](https://www.hackerrank.com/challenges/simple-text-editor) | Medium | Coming Soon! | +| Data Structures | Stacks | [Equal Stacks](https://www.hackerrank.com/challenges/equal-stacks) | Easy | Coming Soon! | +| Data Structures | Stacks | [Poisonous Plants](https://www.hackerrank.com/challenges/poisonous-plants) | Hard | Coming Soon! | +| Data Structures | Stacks | [AND xor OR](https://www.hackerrank.com/challenges/and-xor-or) | Hard | Coming Soon! | +| Data Structures | Stacks | [Waiter](https://www.hackerrank.com/challenges/waiter) | Medium | Coming Soon! | +| Data Structures | Queues | [Queue using Two Stacks](https://www.hackerrank.com/challenges/queue-using-two-stacks) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Queues/Queue%20using%20Two%20Stacks/Solution.java) | +| Data Structures | Queues | [Castle on the Grid](https://www.hackerrank.com/challenges/castle-on-the-grid) | Medium | Coming Soon! | +| Data Structures | Queues | [Down to Zero II](https://www.hackerrank.com/challenges/down-to-zero-ii) | Medium | Coming Soon! | +| Data Structures | Queues | [Truck Tour](https://www.hackerrank.com/challenges/truck-tour) | Hard | Coming Soon! | +| Data Structures | Queues | [Queries with Fixed Length](https://www.hackerrank.com/challenges/queries-with-fixed-length) | Hard | Coming Soon! | +| Data Structures | Heap | [QHEAP1](https://www.hackerrank.com/challenges/qheap1) | Easy | Coming Soon! | +| Data Structures | Heap | [Jesse and Cookies](https://www.hackerrank.com/challenges/jesse-and-cookies) | Easy | Coming Soon! | +| Data Structures | Heap | [Find the Running Median](https://www.hackerrank.com/challenges/find-the-running-median) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Heap/Find%20the%20Running%20Median/Solution.java) | +| Data Structures | Heap | [Minimum Average Waiting Time](https://www.hackerrank.com/challenges/minimum-average-waiting-time) | Hard | Coming Soon! | +| Data Structures | Disjoint Set | [Merging Communities](https://www.hackerrank.com/challenges/merging-communities) | Hard | Coming Soon! | +| Data Structures | Disjoint Set | [Components in a graph](https://www.hackerrank.com/challenges/components-in-graph) | Medium | Coming Soon! | +| Data Structures | Disjoint Set | [Kundu and Tree](https://www.hackerrank.com/challenges/kundu-and-tree) | Hard | Coming Soon! | +| Data Structures | Disjoint Set | [Super Maximum Cost Queries](https://www.hackerrank.com/challenges/maximum-cost-queries) | Hard | Coming Soon! | +| Data Structures | Multiple Choice | [Data Structures MCQ 1](https://www.hackerrank.com/challenges/how-well-do-you-know-trees) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Multiple%20Choice/Data%20Structures%20MCQ%201/Solution.java) | +| Data Structures | Multiple Choice | [Data Structures MCQ 2](https://www.hackerrank.com/challenges/are-you-an-expert-on-data-structures) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Multiple%20Choice/Data%20Structures%20MCQ%202/Solution.java) | +| Data Structures | Multiple Choice | [Data Structures MCQ 3](https://www.hackerrank.com/challenges/are-you-an-expert-on-data-structures-1) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Multiple%20Choice/Data%20Structures%20MCQ%203/Solution.java) | +| Data Structures | Trie | [Contacts](https://www.hackerrank.com/challenges/contacts) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trie/Contacts/Solution.java) | +| Data Structures | Trie | [No Prefix Set](https://www.hackerrank.com/challenges/no-prefix-set) | Hard | Coming Soon! | +| Data Structures | Advanced | [Kindergarten Adventures](https://www.hackerrank.com/challenges/kindergarten-adventures) | Medium | Coming Soon! | +| Data Structures | Advanced | [Cube Summation](https://www.hackerrank.com/challenges/cube-summation) | Hard | Coming Soon! | +| Data Structures | Advanced | [Mr. X and His Shots](https://www.hackerrank.com/challenges/x-and-his-shots) | Medium | Coming Soon! | +| Data Structures | Advanced | [Direct Connections](https://www.hackerrank.com/challenges/direct-connections) | Hard | Coming Soon! | +| Data Structures | Advanced | [Subsequence Weighting](https://www.hackerrank.com/challenges/subsequence-weighting) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Jim and the Skyscrapers](https://www.hackerrank.com/challenges/jim-and-the-skyscrapers) | Medium | Coming Soon! | +| Data Structures | Advanced | [Counting On a Tree](https://www.hackerrank.com/challenges/counting-on-a-tree) | Expert | Coming Soon! | +| Data Structures | Advanced | [Unique Colors](https://www.hackerrank.com/challenges/unique-colors) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Self-Driving Bus](https://www.hackerrank.com/challenges/self-driving-bus) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Fibonacci Numbers Tree](https://www.hackerrank.com/challenges/fibonacci-numbers-tree) | Expert | Coming Soon! | +| Data Structures | Advanced | [Functional Palindromes](https://www.hackerrank.com/challenges/functional-palindromes) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Lazy White Falcon](https://www.hackerrank.com/challenges/lazy-white-falcon) | Hard | Coming Soon! | +| Data Structures | Advanced | [Ticket to Ride](https://www.hackerrank.com/challenges/ticket-to-ride) | Expert | Coming Soon! | +| Data Structures | Advanced | [Heavy Light White Falcon](https://www.hackerrank.com/challenges/heavy-light-white-falcon) | Hard | Coming Soon! | +| Data Structures | Advanced | [Sum of the Maximums](https://www.hackerrank.com/challenges/little-alexey-and-sum-of-maximums) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Heavy Light 2 White Falcon](https://www.hackerrank.com/challenges/heavy-light-2-white-falcon) | Hard | Coming Soon! | +| Data Structures | Advanced | [Library Query](https://www.hackerrank.com/challenges/library-query) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Starfleet](https://www.hackerrank.com/challenges/starfleet) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Almost Equal - Advanced](https://www.hackerrank.com/challenges/almost-equal-advanced) | Expert | Coming Soon! | +| Data Structures | Advanced | [Almost sorted interval](https://www.hackerrank.com/challenges/almost-sorted-interval) | Expert | Coming Soon! | +| Data Structures | Advanced | [Burger Happiness](https://www.hackerrank.com/challenges/burger-happiness) | Hard | Coming Soon! | +| Data Structures | Advanced | [Roy and alpha-beta trees](https://www.hackerrank.com/challenges/roy-and-alpha-beta-trees) | Hard | Coming Soon! | +| Data Structures | Advanced | [Coloring Tree](https://www.hackerrank.com/challenges/coloring-tree) | Hard | Coming Soon! | +| Data Structures | Advanced | [Recalling Early Days GP with Trees](https://www.hackerrank.com/challenges/recalling-early-days-gp-with-trees) | Hard | Coming Soon! | +| Data Structures | Advanced | [Swaps and Sum](https://www.hackerrank.com/challenges/swaps-and-sum) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Arithmetic Progressions](https://www.hackerrank.com/challenges/arithmetic-progressions) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Coolguy and Two Subsequences](https://www.hackerrank.com/challenges/coolguy-and-two-subsequences) | Advanced | Coming Soon! | +| Data Structures | Advanced | [White Falcon And Tree](https://www.hackerrank.com/challenges/white-falcon-and-tree) | Hard | Coming Soon! | +| Data Structures | Advanced | [Subtrees And Paths](https://www.hackerrank.com/challenges/subtrees-and-paths) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Triplets](https://www.hackerrank.com/challenges/triplets) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Beautiful Segments](https://www.hackerrank.com/challenges/beautiful-segments) | Expert | Coming Soon! | +| Data Structures | Advanced | [Divisibility](https://www.hackerrank.com/challenges/ab0) | Expert | Coming Soon! | +| Data Structures | Advanced | [BST maintenance](https://www.hackerrank.com/challenges/bst-maintenance) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Find Maximum Index Product](https://www.hackerrank.com/challenges/find-maximum-index-product) | Medium | Coming Soon! | +| Data Structures | Advanced | [Taxicab Driver's Problem](https://www.hackerrank.com/challenges/taxicab-drivers-problem) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Jaggu Playing with Balloons](https://www.hackerrank.com/challenges/jagia-playing-with-numbers) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Dynamic Summation](https://www.hackerrank.com/challenges/dynamic-summation) | Hard | Coming Soon! | +| Data Structures | Advanced | [Two Array Problem](https://www.hackerrank.com/challenges/weird-queries) | Hard | Coming Soon! | +| Data Structures | Advanced | [Rooted Tree](https://www.hackerrank.com/challenges/rooted-tree) | Hard | Coming Soon! | +| Data Structures | Advanced | [The crazy helix](https://www.hackerrank.com/challenges/helix) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Network administration](https://www.hackerrank.com/challenges/net-admin) | Hard | Coming Soon! | +| Data Structures | Advanced | [Easy Addition](https://www.hackerrank.com/challenges/easy-addition) | Expert | Coming Soon! | +| Data Structures | Advanced | [Find the permutation](https://www.hackerrank.com/challenges/find-the-permutation) | Expert | Coming Soon! | +| Data Structures | Advanced | [Company Retreat](https://www.hackerrank.com/challenges/company-retreat) | Advanced | Coming Soon! | diff --git a/Java/Advanced/Java MDS/Solution.java b/Java/Advanced/Java MD5/Solution.java similarity index 100% rename from Java/Advanced/Java MDS/Solution.java rename to Java/Advanced/Java MD5/Solution.java diff --git a/Java/README.md b/Java/README.md index f9652be..727a361 100644 --- a/Java/README.md +++ b/Java/README.md @@ -65,5 +65,5 @@ | Java | Advanced | [Java Annotations](https://www.hackerrank.com/challenges/java-annotations) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Java/Advanced/Java%20Annotations/Solution.java) | | Java | Advanced | [Covariant Return Types](https://www.hackerrank.com/challenges/java-covariance) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Java/Advanced/Covariant%20Return%20Types/Solution.java) | | Java | Advanced | [Java Lambda Expressions](https://www.hackerrank.com/challenges/java-lambda-expressions) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Java/Advanced/Java%20Lambda%20Expressions/Solution.java) | -| Java | Advanced | [Java MD5](https://www.hackerrank.com/challenges/java-md5) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Java/Advanced/Java%20MDS/Solution.java) | +| Java | Advanced | [Java MD5](https://www.hackerrank.com/challenges/java-md5) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Java/Advanced/Java%20MD5/Solution.java) | | Java | Advanced | [Java SHA-256](https://www.hackerrank.com/challenges/sha-256) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Java/Advanced/Java%20SHA-256/Solution.java) | diff --git a/Java/Strings/Pattern Syntax Checker/Solution.java b/Java/Strings/Pattern Syntax Checker/Solution.java index aa9be88..0e5202b 100644 --- a/Java/Strings/Pattern Syntax Checker/Solution.java +++ b/Java/Strings/Pattern Syntax Checker/Solution.java @@ -1,3 +1,7 @@ +// Author: Rodney Shaghoulian +// Github: github.com/rshaghoulian +// HackerRank: hackerrank.com/rshaghoulian + import java.util.Scanner; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; diff --git a/README.md b/README.md index 766c78a..d265220 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # HackerRank-solutions -200 efficient solutions to [HackerRank](https://www.hackerrank.com/) problems +228 efficient solutions to [HackerRank](https://www.hackerrank.com/) problems * [10 Days of Statistics](#10-days-of-statistics) (Complete) * [30 Days of Code](#30-days-of-code) (28/30 solutions) -* [Algorithms](#algorithms) (22/362 solutions) +* [Algorithms](#algorithms) (47/365 solutions) * [Cracking the Coding Interview](#cracking-the-coding-interview) (Complete) -* [Data Structures](#data-structures) (38/107 solutions) +* [Data Structures](#data-structures) (41/107 solutions) * [Java](#java) (Complete) Solutions are coded using Java 8 @@ -97,35 +97,38 @@ Solutions are coded using Java 8 | Algorithms | Implementation | [Grading Students](https://www.hackerrank.com/challenges/grading) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Grading%20Students/Solution.java) | | Algorithms | Implementation | [Designer PDF Viewer](https://www.hackerrank.com/challenges/designer-pdf-viewer) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Designer%20PDF%20Viewer/Solution.java) | | Algorithms | Implementation | [Apple and Orange](https://www.hackerrank.com/challenges/apple-and-orange) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Apple%20and%20Orange/Solution.java) | -| Algorithms | Implementation | [Kangaroo](https://www.hackerrank.com/challenges/kangaroo) | Easy | Coming Soon! | -| Algorithms | Implementation | [Between Two Sets](https://www.hackerrank.com/challenges/between-two-sets) | Easy | Coming Soon! | -| Algorithms | Implementation | [Divisible Sum Pairs](https://www.hackerrank.com/challenges/divisible-sum-pairs) | Easy | Coming Soon! | -| Algorithms | Implementation | [Bon Appetit](https://www.hackerrank.com/challenges/bon-appetit) | Easy | Coming Soon! | -| Algorithms | Implementation | [Sock Merchant](https://www.hackerrank.com/challenges/sock-merchant) | Easy | Coming Soon! | -| Algorithms | Implementation | [Utopian Tree](https://www.hackerrank.com/challenges/utopian-tree) | Easy | Coming Soon! | +| Algorithms | Implementation | [Kangaroo](https://www.hackerrank.com/challenges/kangaroo) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Kangaroo/Solution.java) | +| Algorithms | Implementation | [Between Two Sets](https://www.hackerrank.com/challenges/between-two-sets) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Between%20Two%20Sets/Solution.java) | +| Algorithms | Implementation | [Divisible Sum Pairs](https://www.hackerrank.com/challenges/divisible-sum-pairs) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Divisible%20Sum%20Pairs/Solution.java) | +| Algorithms | Implementation | [Bon Appetit](https://www.hackerrank.com/challenges/bon-appetit) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Bon%20Appetit/Solution.java) | +| Algorithms | Implementation | [Sock Merchant](https://www.hackerrank.com/challenges/sock-merchant) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Sock%20Merchant/Solution.java) | +| Algorithms | Implementation | [The Hurdle Race](https://www.hackerrank.com/challenges/the-hurdle-race) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/The%20Hurdle%20Race/Solution.java) | +| Algorithms | Implementation | [Utopian Tree](https://www.hackerrank.com/challenges/utopian-tree) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Utopian%20Tree/Solution.java) | | Algorithms | Implementation | [Angry Professor](https://www.hackerrank.com/challenges/angry-professor) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Angry%20Professor/Solution.java) | -| Algorithms | Implementation | [Beautiful Days at the Movies](https://www.hackerrank.com/challenges/beautiful-days-at-the-movies) | Easy | Coming Soon! | -| Algorithms | Implementation | [Viral Advertising](https://www.hackerrank.com/challenges/strange-advertising) | Easy | Coming Soon! | -| Algorithms | Implementation | [Save the Prisoner!](https://www.hackerrank.com/challenges/save-the-prisoner) | Easy | Coming Soon! | +| Algorithms | Implementation | [Beautiful Days at the Movies](https://www.hackerrank.com/challenges/beautiful-days-at-the-movies) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Beautiful%20Days%20at%20the%20Movies/Solution.java) | +| Algorithms | Implementation | [Viral Advertising](https://www.hackerrank.com/challenges/strange-advertising) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Viral%20Advertising/Solution.java) | +| Algorithms | Implementation | [Save the Prisoner!](https://www.hackerrank.com/challenges/save-the-prisoner) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Save%20the%20Prisoner!/Solution.java) | +| Algorithms | Implementation | [Sequence Equation](https://www.hackerrank.com/challenges/permutation-equation) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Sequence%20Equation/Solution.java) | | Algorithms | Implementation | [Circular Array Rotation](https://www.hackerrank.com/challenges/circular-array-rotation) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Circular%20Array%20Rotation/Solution.java) | -| Algorithms | Implementation | [Jumping on the Clouds - Revisited](https://www.hackerrank.com/challenges/jumping-on-the-clouds-revisited) | Easy | Coming Soon! | -| Algorithms | Implementation | [Find Digits](https://www.hackerrank.com/challenges/find-digits) | Easy | Coming Soon! | -| Algorithms | Implementation | [Extra Long Factorials](https://www.hackerrank.com/challenges/extra-long-factorials) | Medium | Coming Soon! | -| Algorithms | Implementation | [Append and Delete](https://www.hackerrank.com/challenges/append-and-delete) | Easy | Coming Soon! | -| Algorithms | Implementation | [Sherlock and Squares](https://www.hackerrank.com/challenges/sherlock-and-squares) | Easy | Coming Soon! | -| Algorithms | Implementation | [Library Fine](https://www.hackerrank.com/challenges/library-fine) | Easy | Coming Soon! | +| Algorithms | Implementation | [Jumping on the Clouds - Revisited](https://www.hackerrank.com/challenges/jumping-on-the-clouds-revisited) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Jumping%20on%20the%20Clouds%20-%20Revisited/Solution.java) | +| Algorithms | Implementation | [Find Digits](https://www.hackerrank.com/challenges/find-digits) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Find%20Digits/Solution.java) | +| Algorithms | Implementation | [Extra Long Factorials](https://www.hackerrank.com/challenges/extra-long-factorials) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Extra%20Long%20Factorials/Solution.java) | +| Algorithms | Implementation | [Append and Delete](https://www.hackerrank.com/challenges/append-and-delete) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Append%20and%20Delete/Solution.java) | +| Algorithms | Implementation | [Sherlock and Squares](https://www.hackerrank.com/challenges/sherlock-and-squares) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Sherlock%20and%20Squares/Solution.java) | +| Algorithms | Implementation | [Library Fine](https://www.hackerrank.com/challenges/library-fine) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Library%20Fine/Solution.java) | | Algorithms | Implementation | [Cut the sticks](https://www.hackerrank.com/challenges/cut-the-sticks) | Easy | Coming Soon! | | Algorithms | Implementation | [Non-Divisible Subset](https://www.hackerrank.com/challenges/non-divisible-subset) | Medium | Coming Soon! | -| Algorithms | Implementation | [Repeated String](https://www.hackerrank.com/challenges/repeated-string) | Easy | Coming Soon! | -| Algorithms | Implementation | [Jumping on the Clouds](https://www.hackerrank.com/challenges/jumping-on-the-clouds) | Easy | Coming Soon! | -| Algorithms | Implementation | [Equalize the Array](https://www.hackerrank.com/challenges/equality-in-a-array) | Easy | Coming Soon! | +| Algorithms | Implementation | [Repeated String](https://www.hackerrank.com/challenges/repeated-string) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Repeated%20String/Solution.java) | +| Algorithms | Implementation | [Jumping on the Clouds](https://www.hackerrank.com/challenges/jumping-on-the-clouds) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Jumping%20on%20the%20Clouds/Solution.java) | +| Algorithms | Implementation | [Equalize the Array](https://www.hackerrank.com/challenges/equality-in-a-array) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Equalize%20the%20Array/Solution.java) | | Algorithms | Implementation | [ACM ICPC Team](https://www.hackerrank.com/challenges/acm-icpc-team) | Easy | Coming Soon! | -| Algorithms | Implementation | [Taum and B'day](https://www.hackerrank.com/challenges/taum-and-bday) | Easy | Coming Soon! | +| Algorithms | Implementation | [Taum and B'day](https://www.hackerrank.com/challenges/taum-and-bday) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Taum%20and%20B%27day/Solution.java) | +| Algorithms | Implementation | [Organizing Containers of Balls](https://www.hackerrank.com/challenges/organizing-containers-of-balls) | Medium | Coming Soon! | | Algorithms | Implementation | [Encryption](https://www.hackerrank.com/challenges/encryption) | Medium | Coming Soon! | | Algorithms | Implementation | [Bigger is Greater](https://www.hackerrank.com/challenges/bigger-is-greater) | Medium | Coming Soon! | -| Algorithms | Implementation | [Modified Kaprekar Numbers](https://www.hackerrank.com/challenges/kaprekar-numbers) | Easy | Coming Soon! | -| Algorithms | Implementation | [Beautiful Triplets](https://www.hackerrank.com/challenges/beautiful-triplets) | Easy | Coming Soon! | -| Algorithms | Implementation | [Manasa and Stones](https://www.hackerrank.com/challenges/manasa-and-stones) | Easy | Coming Soon! | +| Algorithms | Implementation | [Modified Kaprekar Numbers](https://www.hackerrank.com/challenges/kaprekar-numbers) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Modified%20Kaprekar%20Numbers/Solution.java) | +| Algorithms | Implementation | [Beautiful Triplets](https://www.hackerrank.com/challenges/beautiful-triplets) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Beautiful%20Triplets/Solution.java) | +| Algorithms | Implementation | [Manasa and Stones](https://www.hackerrank.com/challenges/manasa-and-stones) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Implementation/Manasa%20and%20Stones/Solution.java) | | Algorithms | Implementation | [Minimum Distances](https://www.hackerrank.com/challenges/minimum-distances) | Easy | Coming Soon! | | Algorithms | Implementation | [The Time in Words](https://www.hackerrank.com/challenges/the-time-in-words) | Medium | Coming Soon! | | Algorithms | Implementation | [Cavity Map](https://www.hackerrank.com/challenges/cavity-map) | Easy | Coming Soon! | @@ -293,7 +296,7 @@ Solutions are coded using Java 8 | Algorithms | Greedy | [Accessory Collection](https://www.hackerrank.com/challenges/accessory-collection) | Hard | Coming Soon! | | Algorithms | Greedy | [Team Formation](https://www.hackerrank.com/challenges/team-formation) | Advanced | Coming Soon! | | Algorithms | Greedy | [Fighting Pits](https://www.hackerrank.com/challenges/fighting-pits) | Hard | Coming Soon! | -| Algorithms | Dynamic Programming | [The Coin Change Problem](https://www.hackerrank.com/challenges/coin-change) | Hard | Coming Soon! | +| Algorithms | Dynamic Programming | [The Coin Change Problem](https://www.hackerrank.com/challenges/coin-change) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Algorithms/Dynamic%20Programming/The%20Coin%20Change%20Problem/Solution.java) | | Algorithms | Dynamic Programming | [Equal](https://www.hackerrank.com/challenges/equal) | Medium | Coming Soon! | | Algorithms | Dynamic Programming | [Sherlock and Cost](https://www.hackerrank.com/challenges/sherlock-and-cost) | Medium | Coming Soon! | | Algorithms | Dynamic Programming | [Vertical Sticks](https://www.hackerrank.com/challenges/vertical-sticks) | Medium | Coming Soon! | @@ -419,7 +422,7 @@ Solutions are coded using Java 8 | Algorithms | Game Theory | [Tower Breakers](https://www.hackerrank.com/challenges/tower-breakers-1) | Easy | Coming Soon! | | Algorithms | Game Theory | [A Chessboard Game](https://www.hackerrank.com/challenges/a-chessboard-game-1) | Easy | Coming Soon! | | Algorithms | Game Theory | [Introduction to Nim Game](https://www.hackerrank.com/challenges/nim-game-1) | Easy | Coming Soon! | -| Algorithms | Game Theory | [MisĨre Nim](https://www.hackerrank.com/challenges/misere-nim-1) | Easy | Coming Soon! | +| Algorithms | Game Theory | [Misere Nim](https://www.hackerrank.com/challenges/misere-nim-1) | Easy | Coming Soon! | | Algorithms | Game Theory | [Nimble Game](https://www.hackerrank.com/challenges/nimble-game-1) | Easy | Coming Soon! | | Algorithms | Game Theory | [Poker Nim](https://www.hackerrank.com/challenges/poker-nim-1) | Easy | Coming Soon! | | Algorithms | Game Theory | [Tower Breakers, Revisited!](https://www.hackerrank.com/challenges/tower-breakers-revisited-1) | Medium | Coming Soon! | @@ -477,115 +480,115 @@ Solutions are coded using Java 8 ## Data Structures -| Domain | Subdomain | Challenge | Difficulty | Solution | -|:---------------:|:---------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| -| Data Structures | Arrays | [Arrays - DS](https://www.hackerrank.com/challenges/arrays-ds) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Arrays%20-%20DS/Solution.java) | -| Data Structures | Arrays | [2D Array - DS](https://www.hackerrank.com/challenges/2d-array) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/2D%20Array%20-%20DS/Solution.java) | -| Data Structures | Arrays | [Dynamic Array](https://www.hackerrank.com/challenges/dynamic-array) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Dynamic%20Array/Solution.java) | -| Data Structures | Arrays | [Left Rotation](https://www.hackerrank.com/challenges/array-left-rotation) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Left%20Rotation/Solution.java) | -| Data Structures | Arrays | [Sparse Arrays](https://www.hackerrank.com/challenges/sparse-arrays) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Sparse%20Arrays/Solution.java) | -| Data Structures | Arrays | [Algorithmic Crush](https://www.hackerrank.com/challenges/crush) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Algorithmic%20Crush/Solution.java) | -| Data Structures | Linked List | [Print the Elements of a Linked List](https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Print%20the%20Elements%20of%20a%20Linked%20List/Solution.java) | -| Data Structures | Linked List | [Insert a Node at the Tail of a Linked List](https://www.hackerrank.com/challenges/insert-a-node-at-the-tail-of-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Insert%20a%20Node%20at%20the%20Tail%20of%20a%20Linked%20List/Solution.java) | -| Data Structures | Linked List | [Insert a node at the head of a linked list](https://www.hackerrank.com/challenges/insert-a-node-at-the-head-of-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Insert%20a%20node%20at%20the%20head%20of%20a%20linked%20list/Solution.java) | -| Data Structures | Linked List | [Insert a node at a specific position in a linked list](https://www.hackerrank.com/challenges/insert-a-node-at-a-specific-position-in-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Insert%20a%20node%20at%20a%20specific%20position%20in%20a%20linked%20list/Solution.java) | -| Data Structures | Linked List | [Delete a Node](https://www.hackerrank.com/challenges/delete-a-node-from-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Delete%20a%20Node/Solution.java) | -| Data Structures | Linked List | [Print in Reverse](https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list-in-reverse) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Print%20in%20Reverse/Solution.java) | -| Data Structures | Linked List | [Reverse a linked list](https://www.hackerrank.com/challenges/reverse-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Reverse%20a%20linked%20list/Solution.java) | -| Data Structures | Linked List | [Compare two linked lists](https://www.hackerrank.com/challenges/compare-two-linked-lists) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Compare%20two%20linked%20lists/Solution.java) | -| Data Structures | Linked List | [Merge two sorted linked lists](https://www.hackerrank.com/challenges/merge-two-sorted-linked-lists) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Merge%20two%20sorted%20linked%20lists/Solution.java) | -| Data Structures | Linked List | [Get Node Value](https://www.hackerrank.com/challenges/get-the-value-of-the-node-at-a-specific-position-from-the-tail) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Get%20Node%20Value/Solution.java) | -| Data Structures | Linked List | [Delete duplicate-value nodes from a sorted linked list](https://www.hackerrank.com/challenges/delete-duplicate-value-nodes-from-a-sorted-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Delete%20duplicate-value%20nodes%20from%20a%20sorted%20linked%20list/Solution.java) | -| Data Structures | Linked List | [Cycle Detection](https://www.hackerrank.com/challenges/detect-whether-a-linked-list-contains-a-cycle) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Cycle%20Detection/Solution.java) | -| Data Structures | Linked List | [Find Merge Point of Two Lists](https://www.hackerrank.com/challenges/find-the-merge-point-of-two-joined-linked-lists) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Find%20Merge%20Point%20of%20Two%20Lists/Solution.java) | -| Data Structures | Linked List | [Inserting a Node Into a Sorted Doubly Linked List](https://www.hackerrank.com/challenges/insert-a-node-into-a-sorted-doubly-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Inserting%20a%20Node%20Into%20a%20Sorted%20Doubly%20Linked%20List/Solution.java) | -| Data Structures | Linked List | [Reverse a doubly linked list](https://www.hackerrank.com/challenges/reverse-a-doubly-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Reverse%20a%20doubly%20linked%20list/Solution.java) | -| Data Structures | Trees | [Tree: Preorder Traversal](https://www.hackerrank.com/challenges/tree-preorder-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Preorder%20Traversal/Solution.java) | -| Data Structures | Trees | [Tree: Postorder Traversal](https://www.hackerrank.com/challenges/tree-postorder-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Postorder%20Traversal/Solution.java) | -| Data Structures | Trees | [Tree: Inorder Traversal](https://www.hackerrank.com/challenges/tree-inorder-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Inorder%20Traversal/Solution.java) | -| Data Structures | Trees | [Tree: Height of a Binary Tree](https://www.hackerrank.com/challenges/tree-height-of-a-binary-tree) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Height%20of%20a%20Binary%20Tree/Solution.java) | -| Data Structures | Trees | [Tree: Top View](https://www.hackerrank.com/challenges/tree-top-view) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Top%20View/Solution.java) | -| Data Structures | Trees | [Tree: Level Order Traversal](https://www.hackerrank.com/challenges/tree-level-order-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Level%20Order%20Traversal/Solution.java) | -| Data Structures | Trees | [Binary Search Tree: Insertion](https://www.hackerrank.com/challenges/binary-search-tree-insertion) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Binary%20Search%20Tree%20-%20Insertion/Solution.java) | -| Data Structures | Trees | [Tree: Huffman Decoding](https://www.hackerrank.com/challenges/tree-huffman-decoding) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Huffman%20Decoding/Solution.java) | -| Data Structures | Trees | [Binary Search Tree: Lowest Common Ancestor](https://www.hackerrank.com/challenges/binary-search-tree-lowest-common-ancestor) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Binary%20Search%20Tree%20-%20Lowest%20Common%20Ancestor/Solution.java) | -| Data Structures | Trees | [Swap Nodes [Algo]](https://www.hackerrank.com/challenges/swap-nodes-algo) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Swap%20Nodes%20%5BAlgo%5D/Solution.java) | -| Data Structures | Trees | [Is This a Binary Search Tree?](https://www.hackerrank.com/challenges/is-binary-search-tree) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Is%20This%20a%20Binary%20Search%20Tree/Solution.java) | -| Data Structures | Trees | [Square-Ten Tree](https://www.hackerrank.com/challenges/square-ten-tree) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Square-Ten%20Tree/Solution.java) | -| Data Structures | Trees | [Balanced Forest](https://www.hackerrank.com/challenges/balanced-forest) | Hard | Coming Soon! | -| Data Structures | Balanced Trees | [Self Balancing Tree](https://www.hackerrank.com/challenges/self-balancing-tree) | Medium | Coming Soon! | -| Data Structures | Balanced Trees | [Array and simple queries](https://www.hackerrank.com/challenges/array-and-simple-queries) | Hard | Coming Soon! | -| Data Structures | Balanced Trees | [Median Updates](https://www.hackerrank.com/challenges/median) | Hard | Coming Soon! | -| Data Structures | Stacks | [Maximum Element](https://www.hackerrank.com/challenges/maximum-element) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Stacks/Maximum%20Element/Solution.java) | -| Data Structures | Stacks | [Balanced Brackets](https://www.hackerrank.com/challenges/balanced-brackets) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Stacks/Balanced%20Brackets/Solution.java) | -| Data Structures | Stacks | [Largest Rectangle](https://www.hackerrank.com/challenges/largest-rectangle) | Hard | Coming Soon! | -| Data Structures | Stacks | [Simple Text Editor](https://www.hackerrank.com/challenges/simple-text-editor) | Medium | Coming Soon! | -| Data Structures | Stacks | [Equal Stacks](https://www.hackerrank.com/challenges/equal-stacks) | Easy | Coming Soon! | -| Data Structures | Stacks | [Poisonous Plants](https://www.hackerrank.com/challenges/poisonous-plants) | Hard | Coming Soon! | -| Data Structures | Stacks | [AND xor OR](https://www.hackerrank.com/challenges/and-xor-or) | Hard | Coming Soon! | -| Data Structures | Stacks | [Waiter](https://www.hackerrank.com/challenges/waiter) | Medium | Coming Soon! | -| Data Structures | Queues | [Queue using Two Stacks](https://www.hackerrank.com/challenges/queue-using-two-stacks) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Queues/Queue%20using%20Two%20Stacks/Solution.java) | -| Data Structures | Queues | [Castle on the Grid](https://www.hackerrank.com/challenges/castle-on-the-grid) | Medium | Coming Soon! | -| Data Structures | Queues | [Down to Zero II](https://www.hackerrank.com/challenges/down-to-zero-ii) | Medium | Coming Soon! | -| Data Structures | Queues | [Truck Tour](https://www.hackerrank.com/challenges/truck-tour) | Hard | Coming Soon! | -| Data Structures | Queues | [Queries with Fixed Length](https://www.hackerrank.com/challenges/queries-with-fixed-length) | Hard | Coming Soon! | -| Data Structures | Heap | [QHEAP1](https://www.hackerrank.com/challenges/qheap1) | Easy | Coming Soon! | -| Data Structures | Heap | [Jesse and Cookies](https://www.hackerrank.com/challenges/jesse-and-cookies) | Easy | Coming Soon! | -| Data Structures | Heap | [Find the Running Median](https://www.hackerrank.com/challenges/find-the-running-median) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Heap/Find%20the%20Running%20Median/Solution.java) | -| Data Structures | Heap | [Minimum Average Waiting Time](https://www.hackerrank.com/challenges/minimum-average-waiting-time) | Hard | Coming Soon! | -| Data Structures | Disjoint Set | [Merging Communities](https://www.hackerrank.com/challenges/merging-communities) | Hard | Coming Soon! | -| Data Structures | Disjoint Set | [Components in a graph](https://www.hackerrank.com/challenges/components-in-graph) | Medium | Coming Soon! | -| Data Structures | Disjoint Set | [Kundu and Tree](https://www.hackerrank.com/challenges/kundu-and-tree) | Hard | Coming Soon! | -| Data Structures | Disjoint Set | [Super Maximum Cost Queries](https://www.hackerrank.com/challenges/maximum-cost-queries) | Hard | Coming Soon! | -| Data Structures | Multiple Choice | [Data Structures MCQ 1](https://www.hackerrank.com/challenges/how-well-do-you-know-trees) | Multiple Choice | Coming Soon! | -| Data Structures | Multiple Choice | [Data Structures MCQ 2](https://www.hackerrank.com/challenges/are-you-an-expert-on-data-structures) | Multiple Choice | Coming Soon! | -| Data Structures | Multiple Choice | [Data Structures MCQ 3](https://www.hackerrank.com/challenges/are-you-an-expert-on-data-structures-1) | Multiple Choice | Coming Soon! | -| Data Structures | Trie | [Contacts](https://www.hackerrank.com/challenges/contacts) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trie/Contacts/Solution.java) | -| Data Structures | Trie | [No Prefix Set](https://www.hackerrank.com/challenges/no-prefix-set) | Hard | Coming Soon! | -| Data Structures | Advanced | [Kindergarten Adventures](https://www.hackerrank.com/challenges/kindergarten-adventures) | Medium | Coming Soon! | -| Data Structures | Advanced | [Cube Summation](https://www.hackerrank.com/challenges/cube-summation) | Hard | Coming Soon! | -| Data Structures | Advanced | [Mr. X and His Shots](https://www.hackerrank.com/challenges/x-and-his-shots) | Medium | Coming Soon! | -| Data Structures | Advanced | [Direct Connections](https://www.hackerrank.com/challenges/direct-connections) | Hard | Coming Soon! | -| Data Structures | Advanced | [Subsequence Weighting](https://www.hackerrank.com/challenges/subsequence-weighting) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Jim and the Skyscrapers](https://www.hackerrank.com/challenges/jim-and-the-skyscrapers) | Medium | Coming Soon! | -| Data Structures | Advanced | [Counting On a Tree](https://www.hackerrank.com/challenges/counting-on-a-tree) | Expert | Coming Soon! | -| Data Structures | Advanced | [Unique Colors](https://www.hackerrank.com/challenges/unique-colors) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Self-Driving Bus](https://www.hackerrank.com/challenges/self-driving-bus) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Fibonacci Numbers Tree](https://www.hackerrank.com/challenges/fibonacci-numbers-tree) | Expert | Coming Soon! | -| Data Structures | Advanced | [Functional Palindromes](https://www.hackerrank.com/challenges/functional-palindromes) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Lazy White Falcon](https://www.hackerrank.com/challenges/lazy-white-falcon) | Hard | Coming Soon! | -| Data Structures | Advanced | [Ticket to Ride](https://www.hackerrank.com/challenges/ticket-to-ride) | Expert | Coming Soon! | -| Data Structures | Advanced | [Heavy Light White Falcon](https://www.hackerrank.com/challenges/heavy-light-white-falcon) | Hard | Coming Soon! | -| Data Structures | Advanced | [Sum of the Maximums](https://www.hackerrank.com/challenges/little-alexey-and-sum-of-maximums) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Heavy Light 2 White Falcon](https://www.hackerrank.com/challenges/heavy-light-2-white-falcon) | Hard | Coming Soon! | -| Data Structures | Advanced | [Library Query](https://www.hackerrank.com/challenges/library-query) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Starfleet](https://www.hackerrank.com/challenges/starfleet) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Almost Equal - Advanced](https://www.hackerrank.com/challenges/almost-equal-advanced) | Expert | Coming Soon! | -| Data Structures | Advanced | [Almost sorted interval](https://www.hackerrank.com/challenges/almost-sorted-interval) | Expert | Coming Soon! | -| Data Structures | Advanced | [Burger Happiness](https://www.hackerrank.com/challenges/burger-happiness) | Hard | Coming Soon! | -| Data Structures | Advanced | [Roy and alpha-beta trees](https://www.hackerrank.com/challenges/roy-and-alpha-beta-trees) | Hard | Coming Soon! | -| Data Structures | Advanced | [Coloring Tree](https://www.hackerrank.com/challenges/coloring-tree) | Hard | Coming Soon! | -| Data Structures | Advanced | [Recalling Early Days GP with Trees](https://www.hackerrank.com/challenges/recalling-early-days-gp-with-trees) | Hard | Coming Soon! | -| Data Structures | Advanced | [Swaps and Sum](https://www.hackerrank.com/challenges/swaps-and-sum) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Arithmetic Progressions](https://www.hackerrank.com/challenges/arithmetic-progressions) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Coolguy and Two Subsequences](https://www.hackerrank.com/challenges/coolguy-and-two-subsequences) | Advanced | Coming Soon! | -| Data Structures | Advanced | [White Falcon And Tree](https://www.hackerrank.com/challenges/white-falcon-and-tree) | Hard | Coming Soon! | -| Data Structures | Advanced | [Subtrees And Paths](https://www.hackerrank.com/challenges/subtrees-and-paths) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Triplets](https://www.hackerrank.com/challenges/triplets) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Beautiful Segments](https://www.hackerrank.com/challenges/beautiful-segments) | Expert | Coming Soon! | -| Data Structures | Advanced | [Divisibility](https://www.hackerrank.com/challenges/ab0) | Expert | Coming Soon! | -| Data Structures | Advanced | [BST maintenance](https://www.hackerrank.com/challenges/bst-maintenance) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Find Maximum Index Product](https://www.hackerrank.com/challenges/find-maximum-index-product) | Medium | Coming Soon! | -| Data Structures | Advanced | [Taxicab Driver's Problem](https://www.hackerrank.com/challenges/taxicab-drivers-problem) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Jaggu Playing with Balloons](https://www.hackerrank.com/challenges/jagia-playing-with-numbers) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Dynamic Summation](https://www.hackerrank.com/challenges/dynamic-summation) | Hard | Coming Soon! | -| Data Structures | Advanced | [Two Array Problem](https://www.hackerrank.com/challenges/weird-queries) | Hard | Coming Soon! | -| Data Structures | Advanced | [Rooted Tree](https://www.hackerrank.com/challenges/rooted-tree) | Hard | Coming Soon! | -| Data Structures | Advanced | [The crazy helix](https://www.hackerrank.com/challenges/helix) | Advanced | Coming Soon! | -| Data Structures | Advanced | [Network administration](https://www.hackerrank.com/challenges/net-admin) | Hard | Coming Soon! | -| Data Structures | Advanced | [Easy Addition](https://www.hackerrank.com/challenges/easy-addition) | Expert | Coming Soon! | -| Data Structures | Advanced | [Find the permutation](https://www.hackerrank.com/challenges/find-the-permutation) | Expert | Coming Soon! | -| Data Structures | Advanced | [Company Retreat](https://www.hackerrank.com/challenges/company-retreat) | Advanced | Coming Soon! | +| Domain | Subdomain | Challenge | Difficulty | Solution | +|:---------------:|:---------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| +| Data Structures | Arrays | [Arrays - DS](https://www.hackerrank.com/challenges/arrays-ds) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Arrays%20-%20DS/Solution.java) | +| Data Structures | Arrays | [2D Array - DS](https://www.hackerrank.com/challenges/2d-array) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/2D%20Array%20-%20DS/Solution.java) | +| Data Structures | Arrays | [Dynamic Array](https://www.hackerrank.com/challenges/dynamic-array) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Dynamic%20Array/Solution.java) | +| Data Structures | Arrays | [Left Rotation](https://www.hackerrank.com/challenges/array-left-rotation) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Left%20Rotation/Solution.java) | +| Data Structures | Arrays | [Sparse Arrays](https://www.hackerrank.com/challenges/sparse-arrays) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Sparse%20Arrays/Solution.java) | +| Data Structures | Arrays | [Algorithmic Crush](https://www.hackerrank.com/challenges/crush) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Arrays/Algorithmic%20Crush/Solution.java) | +| Data Structures | Linked List | [Print the Elements of a Linked List](https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Print%20the%20Elements%20of%20a%20Linked%20List/Solution.java) | +| Data Structures | Linked List | [Insert a Node at the Tail of a Linked List](https://www.hackerrank.com/challenges/insert-a-node-at-the-tail-of-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Insert%20a%20Node%20at%20the%20Tail%20of%20a%20Linked%20List/Solution.java) | +| Data Structures | Linked List | [Insert a node at the head of a linked list](https://www.hackerrank.com/challenges/insert-a-node-at-the-head-of-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Insert%20a%20node%20at%20the%20head%20of%20a%20linked%20list/Solution.java) | +| Data Structures | Linked List | [Insert a node at a specific position in a linked list](https://www.hackerrank.com/challenges/insert-a-node-at-a-specific-position-in-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Insert%20a%20node%20at%20a%20specific%20position%20in%20a%20linked%20list/Solution.java) | +| Data Structures | Linked List | [Delete a Node](https://www.hackerrank.com/challenges/delete-a-node-from-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Delete%20a%20Node/Solution.java) | +| Data Structures | Linked List | [Print in Reverse](https://www.hackerrank.com/challenges/print-the-elements-of-a-linked-list-in-reverse) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Print%20in%20Reverse/Solution.java) | +| Data Structures | Linked List | [Reverse a linked list](https://www.hackerrank.com/challenges/reverse-a-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Reverse%20a%20linked%20list/Solution.java) | +| Data Structures | Linked List | [Compare two linked lists](https://www.hackerrank.com/challenges/compare-two-linked-lists) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Compare%20two%20linked%20lists/Solution.java) | +| Data Structures | Linked List | [Merge two sorted linked lists](https://www.hackerrank.com/challenges/merge-two-sorted-linked-lists) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Merge%20two%20sorted%20linked%20lists/Solution.java) | +| Data Structures | Linked List | [Get Node Value](https://www.hackerrank.com/challenges/get-the-value-of-the-node-at-a-specific-position-from-the-tail) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Get%20Node%20Value/Solution.java) | +| Data Structures | Linked List | [Delete duplicate-value nodes from a sorted linked list](https://www.hackerrank.com/challenges/delete-duplicate-value-nodes-from-a-sorted-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Delete%20duplicate-value%20nodes%20from%20a%20sorted%20linked%20list/Solution.java) | +| Data Structures | Linked List | [Cycle Detection](https://www.hackerrank.com/challenges/detect-whether-a-linked-list-contains-a-cycle) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Cycle%20Detection/Solution.java) | +| Data Structures | Linked List | [Find Merge Point of Two Lists](https://www.hackerrank.com/challenges/find-the-merge-point-of-two-joined-linked-lists) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Find%20Merge%20Point%20of%20Two%20Lists/Solution.java) | +| Data Structures | Linked List | [Inserting a Node Into a Sorted Doubly Linked List](https://www.hackerrank.com/challenges/insert-a-node-into-a-sorted-doubly-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Inserting%20a%20Node%20Into%20a%20Sorted%20Doubly%20Linked%20List/Solution.java) | +| Data Structures | Linked List | [Reverse a doubly linked list](https://www.hackerrank.com/challenges/reverse-a-doubly-linked-list) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Linked%20Lists/Reverse%20a%20doubly%20linked%20list/Solution.java) | +| Data Structures | Trees | [Tree: Preorder Traversal](https://www.hackerrank.com/challenges/tree-preorder-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Preorder%20Traversal/Solution.java) | +| Data Structures | Trees | [Tree: Postorder Traversal](https://www.hackerrank.com/challenges/tree-postorder-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Postorder%20Traversal/Solution.java) | +| Data Structures | Trees | [Tree: Inorder Traversal](https://www.hackerrank.com/challenges/tree-inorder-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Inorder%20Traversal/Solution.java) | +| Data Structures | Trees | [Tree: Height of a Binary Tree](https://www.hackerrank.com/challenges/tree-height-of-a-binary-tree) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Height%20of%20a%20Binary%20Tree/Solution.java) | +| Data Structures | Trees | [Tree: Top View](https://www.hackerrank.com/challenges/tree-top-view) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Top%20View/Solution.java) | +| Data Structures | Trees | [Tree: Level Order Traversal](https://www.hackerrank.com/challenges/tree-level-order-traversal) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Level%20Order%20Traversal/Solution.java) | +| Data Structures | Trees | [Binary Search Tree: Insertion](https://www.hackerrank.com/challenges/binary-search-tree-insertion) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Binary%20Search%20Tree%20-%20Insertion/Solution.java) | +| Data Structures | Trees | [Tree: Huffman Decoding](https://www.hackerrank.com/challenges/tree-huffman-decoding) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Tree%20-%20Huffman%20Decoding/Solution.java) | +| Data Structures | Trees | [Binary Search Tree: Lowest Common Ancestor](https://www.hackerrank.com/challenges/binary-search-tree-lowest-common-ancestor) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Binary%20Search%20Tree%20-%20Lowest%20Common%20Ancestor/Solution.java) | +| Data Structures | Trees | [Swap Nodes [Algo]](https://www.hackerrank.com/challenges/swap-nodes-algo) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Swap%20Nodes%20%5BAlgo%5D/Solution.java) | +| Data Structures | Trees | [Is This a Binary Search Tree?](https://www.hackerrank.com/challenges/is-binary-search-tree) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Is%20This%20a%20Binary%20Search%20Tree/Solution.java) | +| Data Structures | Trees | [Square-Ten Tree](https://www.hackerrank.com/challenges/square-ten-tree) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trees/Square-Ten%20Tree/Solution.java) | +| Data Structures | Trees | [Balanced Forest](https://www.hackerrank.com/challenges/balanced-forest) | Hard | Coming Soon! | +| Data Structures | Balanced Trees | [Self Balancing Tree](https://www.hackerrank.com/challenges/self-balancing-tree) | Medium | Coming Soon! | +| Data Structures | Balanced Trees | [Array and simple queries](https://www.hackerrank.com/challenges/array-and-simple-queries) | Hard | Coming Soon! | +| Data Structures | Balanced Trees | [Median Updates](https://www.hackerrank.com/challenges/median) | Hard | Coming Soon! | +| Data Structures | Stacks | [Maximum Element](https://www.hackerrank.com/challenges/maximum-element) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Stacks/Maximum%20Element/Solution.java) | +| Data Structures | Stacks | [Balanced Brackets](https://www.hackerrank.com/challenges/balanced-brackets) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Stacks/Balanced%20Brackets/Solution.java) | +| Data Structures | Stacks | [Largest Rectangle](https://www.hackerrank.com/challenges/largest-rectangle) | Hard | Coming Soon! | +| Data Structures | Stacks | [Simple Text Editor](https://www.hackerrank.com/challenges/simple-text-editor) | Medium | Coming Soon! | +| Data Structures | Stacks | [Equal Stacks](https://www.hackerrank.com/challenges/equal-stacks) | Easy | Coming Soon! | +| Data Structures | Stacks | [Poisonous Plants](https://www.hackerrank.com/challenges/poisonous-plants) | Hard | Coming Soon! | +| Data Structures | Stacks | [AND xor OR](https://www.hackerrank.com/challenges/and-xor-or) | Hard | Coming Soon! | +| Data Structures | Stacks | [Waiter](https://www.hackerrank.com/challenges/waiter) | Medium | Coming Soon! | +| Data Structures | Queues | [Queue using Two Stacks](https://www.hackerrank.com/challenges/queue-using-two-stacks) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Queues/Queue%20using%20Two%20Stacks/Solution.java) | +| Data Structures | Queues | [Castle on the Grid](https://www.hackerrank.com/challenges/castle-on-the-grid) | Medium | Coming Soon! | +| Data Structures | Queues | [Down to Zero II](https://www.hackerrank.com/challenges/down-to-zero-ii) | Medium | Coming Soon! | +| Data Structures | Queues | [Truck Tour](https://www.hackerrank.com/challenges/truck-tour) | Hard | Coming Soon! | +| Data Structures | Queues | [Queries with Fixed Length](https://www.hackerrank.com/challenges/queries-with-fixed-length) | Hard | Coming Soon! | +| Data Structures | Heap | [QHEAP1](https://www.hackerrank.com/challenges/qheap1) | Easy | Coming Soon! | +| Data Structures | Heap | [Jesse and Cookies](https://www.hackerrank.com/challenges/jesse-and-cookies) | Easy | Coming Soon! | +| Data Structures | Heap | [Find the Running Median](https://www.hackerrank.com/challenges/find-the-running-median) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Heap/Find%20the%20Running%20Median/Solution.java) | +| Data Structures | Heap | [Minimum Average Waiting Time](https://www.hackerrank.com/challenges/minimum-average-waiting-time) | Hard | Coming Soon! | +| Data Structures | Disjoint Set | [Merging Communities](https://www.hackerrank.com/challenges/merging-communities) | Hard | Coming Soon! | +| Data Structures | Disjoint Set | [Components in a graph](https://www.hackerrank.com/challenges/components-in-graph) | Medium | Coming Soon! | +| Data Structures | Disjoint Set | [Kundu and Tree](https://www.hackerrank.com/challenges/kundu-and-tree) | Hard | Coming Soon! | +| Data Structures | Disjoint Set | [Super Maximum Cost Queries](https://www.hackerrank.com/challenges/maximum-cost-queries) | Hard | Coming Soon! | +| Data Structures | Multiple Choice | [Data Structures MCQ 1](https://www.hackerrank.com/challenges/how-well-do-you-know-trees) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Multiple%20Choice/Data%20Structures%20MCQ%201/Solution.java) | +| Data Structures | Multiple Choice | [Data Structures MCQ 2](https://www.hackerrank.com/challenges/are-you-an-expert-on-data-structures) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Multiple%20Choice/Data%20Structures%20MCQ%202/Solution.java) | +| Data Structures | Multiple Choice | [Data Structures MCQ 3](https://www.hackerrank.com/challenges/are-you-an-expert-on-data-structures-1) | Hard | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Multiple%20Choice/Data%20Structures%20MCQ%203/Solution.java) | +| Data Structures | Trie | [Contacts](https://www.hackerrank.com/challenges/contacts) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Data%20Structures/Trie/Contacts/Solution.java) | +| Data Structures | Trie | [No Prefix Set](https://www.hackerrank.com/challenges/no-prefix-set) | Hard | Coming Soon! | +| Data Structures | Advanced | [Kindergarten Adventures](https://www.hackerrank.com/challenges/kindergarten-adventures) | Medium | Coming Soon! | +| Data Structures | Advanced | [Cube Summation](https://www.hackerrank.com/challenges/cube-summation) | Hard | Coming Soon! | +| Data Structures | Advanced | [Mr. X and His Shots](https://www.hackerrank.com/challenges/x-and-his-shots) | Medium | Coming Soon! | +| Data Structures | Advanced | [Direct Connections](https://www.hackerrank.com/challenges/direct-connections) | Hard | Coming Soon! | +| Data Structures | Advanced | [Subsequence Weighting](https://www.hackerrank.com/challenges/subsequence-weighting) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Jim and the Skyscrapers](https://www.hackerrank.com/challenges/jim-and-the-skyscrapers) | Medium | Coming Soon! | +| Data Structures | Advanced | [Counting On a Tree](https://www.hackerrank.com/challenges/counting-on-a-tree) | Expert | Coming Soon! | +| Data Structures | Advanced | [Unique Colors](https://www.hackerrank.com/challenges/unique-colors) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Self-Driving Bus](https://www.hackerrank.com/challenges/self-driving-bus) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Fibonacci Numbers Tree](https://www.hackerrank.com/challenges/fibonacci-numbers-tree) | Expert | Coming Soon! | +| Data Structures | Advanced | [Functional Palindromes](https://www.hackerrank.com/challenges/functional-palindromes) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Lazy White Falcon](https://www.hackerrank.com/challenges/lazy-white-falcon) | Hard | Coming Soon! | +| Data Structures | Advanced | [Ticket to Ride](https://www.hackerrank.com/challenges/ticket-to-ride) | Expert | Coming Soon! | +| Data Structures | Advanced | [Heavy Light White Falcon](https://www.hackerrank.com/challenges/heavy-light-white-falcon) | Hard | Coming Soon! | +| Data Structures | Advanced | [Sum of the Maximums](https://www.hackerrank.com/challenges/little-alexey-and-sum-of-maximums) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Heavy Light 2 White Falcon](https://www.hackerrank.com/challenges/heavy-light-2-white-falcon) | Hard | Coming Soon! | +| Data Structures | Advanced | [Library Query](https://www.hackerrank.com/challenges/library-query) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Starfleet](https://www.hackerrank.com/challenges/starfleet) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Almost Equal - Advanced](https://www.hackerrank.com/challenges/almost-equal-advanced) | Expert | Coming Soon! | +| Data Structures | Advanced | [Almost sorted interval](https://www.hackerrank.com/challenges/almost-sorted-interval) | Expert | Coming Soon! | +| Data Structures | Advanced | [Burger Happiness](https://www.hackerrank.com/challenges/burger-happiness) | Hard | Coming Soon! | +| Data Structures | Advanced | [Roy and alpha-beta trees](https://www.hackerrank.com/challenges/roy-and-alpha-beta-trees) | Hard | Coming Soon! | +| Data Structures | Advanced | [Coloring Tree](https://www.hackerrank.com/challenges/coloring-tree) | Hard | Coming Soon! | +| Data Structures | Advanced | [Recalling Early Days GP with Trees](https://www.hackerrank.com/challenges/recalling-early-days-gp-with-trees) | Hard | Coming Soon! | +| Data Structures | Advanced | [Swaps and Sum](https://www.hackerrank.com/challenges/swaps-and-sum) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Arithmetic Progressions](https://www.hackerrank.com/challenges/arithmetic-progressions) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Coolguy and Two Subsequences](https://www.hackerrank.com/challenges/coolguy-and-two-subsequences) | Advanced | Coming Soon! | +| Data Structures | Advanced | [White Falcon And Tree](https://www.hackerrank.com/challenges/white-falcon-and-tree) | Hard | Coming Soon! | +| Data Structures | Advanced | [Subtrees And Paths](https://www.hackerrank.com/challenges/subtrees-and-paths) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Triplets](https://www.hackerrank.com/challenges/triplets) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Beautiful Segments](https://www.hackerrank.com/challenges/beautiful-segments) | Expert | Coming Soon! | +| Data Structures | Advanced | [Divisibility](https://www.hackerrank.com/challenges/ab0) | Expert | Coming Soon! | +| Data Structures | Advanced | [BST maintenance](https://www.hackerrank.com/challenges/bst-maintenance) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Find Maximum Index Product](https://www.hackerrank.com/challenges/find-maximum-index-product) | Medium | Coming Soon! | +| Data Structures | Advanced | [Taxicab Driver's Problem](https://www.hackerrank.com/challenges/taxicab-drivers-problem) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Jaggu Playing with Balloons](https://www.hackerrank.com/challenges/jagia-playing-with-numbers) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Dynamic Summation](https://www.hackerrank.com/challenges/dynamic-summation) | Hard | Coming Soon! | +| Data Structures | Advanced | [Two Array Problem](https://www.hackerrank.com/challenges/weird-queries) | Hard | Coming Soon! | +| Data Structures | Advanced | [Rooted Tree](https://www.hackerrank.com/challenges/rooted-tree) | Hard | Coming Soon! | +| Data Structures | Advanced | [The crazy helix](https://www.hackerrank.com/challenges/helix) | Advanced | Coming Soon! | +| Data Structures | Advanced | [Network administration](https://www.hackerrank.com/challenges/net-admin) | Hard | Coming Soon! | +| Data Structures | Advanced | [Easy Addition](https://www.hackerrank.com/challenges/easy-addition) | Expert | Coming Soon! | +| Data Structures | Advanced | [Find the permutation](https://www.hackerrank.com/challenges/find-the-permutation) | Expert | Coming Soon! | +| Data Structures | Advanced | [Company Retreat](https://www.hackerrank.com/challenges/company-retreat) | Advanced | Coming Soon! | ## Java @@ -655,5 +658,5 @@ Solutions are coded using Java 8 | Java | Advanced | [Java Annotations](https://www.hackerrank.com/challenges/java-annotations) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Java/Advanced/Java%20Annotations/Solution.java) | | Java | Advanced | [Covariant Return Types](https://www.hackerrank.com/challenges/java-covariance) | Easy | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Java/Advanced/Covariant%20Return%20Types/Solution.java) | | Java | Advanced | [Java Lambda Expressions](https://www.hackerrank.com/challenges/java-lambda-expressions) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Java/Advanced/Java%20Lambda%20Expressions/Solution.java) | -| Java | Advanced | [Java MD5](https://www.hackerrank.com/challenges/java-md5) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Java/Advanced/Java%20MDS/Solution.java) | +| Java | Advanced | [Java MD5](https://www.hackerrank.com/challenges/java-md5) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Java/Advanced/Java%20MD5/Solution.java) | | Java | Advanced | [Java SHA-256](https://www.hackerrank.com/challenges/sha-256) | Medium | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Java/Advanced/Java%20SHA-256/Solution.java) |