Skip to content

cherylyli/100-days-of-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

100-days-of-algorithms

Day 0 [March 8]

  1. Stock Maximize - given a list of prices for stock price on consecutive days, you can either buy one stock or sell as many stocks or do nothing on each day; return the max money you can make. https://www.hackerrank.com/challenges/stockmax

  2. Binary Tree Paths - given a binary tree, return array of all tree paths. https://leetcode.com/problems/binary-tree-paths/

Day 1 [March 9]

  1. Connected Cells in a Grid - given a matrix of 1s and 0s, return size of largest connected 1s. https://www.hackerrank.com/challenges/connected-cell-in-a-grid

  2. Pairs - give a list of unique numbers and a difference, return number of pairs that is different by the difference. https://www.hackerrank.com/challenges/pairs

  3. Integer to English Words - given an integer, return the english word version of it. https://leetcode.com/problems/integer-to-english-words

  4. Best time to sell and buy stock - given a list of prices for stock prices on consecutive days, choose one day to buy 1 stock and one day to sell that stock to maximize profit. https://leetcode.com/problems/best-time-to-buy-and-sell-stock/

Day 2 [March 11]

  1. Merge Sorted Array - Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array in place. https://leetcode.com/problems/merge-sorted-array/

Day 3 [March 12]

  1. Multipy Two Sums - Given two strings, each contains chars from "0"-"9" and up to 110 characters long, return their product. Cannot use big int. https://leetcode.com/problems/multiply-strings/

Day 3.x [March 13-17]

-- suspended because working on AI project

Day 4 [March 20]

  1. Valid Palindrome - given a string, find if it's a valid palindrome, ignoring non alphanumeric values. https://leetcode.com/problems/valid-palindrome/

Day 5 [March 24]

Practicing SQLs on Leetcode 10. Combine Two Tables - Write a SQL query for a report that provides name and address for each person in the Person table, regardless if there is an address for each of those people. Address and Person is two separate tables. https://leetcode.com/problems/combine-two-tables

  1. Second Highest Salary- an SQL query for the second highest listed salary from an Employees(id, salary) table. https://leetcode.com/problems/second-highest-salary

  2. Substrings sum - return sum of substrings of an input; eg. input: "1234" output: 1 + 2 + 3 + 4 + 12 + 23 + 34 + 123 + 234 + 1234 mod (10^9 + 7). Input is smaller than 2*10^5. https://www.hackerrank.com/challenges/sam-and-substrings

  3. Substrings sum - same problem as #12, different implementation.

Day 6 [March 30]

  1. Reverse String - as the name suggests https://leetcode.com/problems/reverse-string/

Day 7 [March 31]

  1. Nim Game - 2 player game where players take turn removing stones from a heap. In each turn 1, 2, or 3 stones may be removed. Return whether or not a player would be able to win, given the number of stones in the heap and that the player always goes first. https://leetcode.com/problems/nim-game/

Day 8 [April 2]

  1. Single Number - Given an array of integers, every element appears twice except for one. Find that single one. https://leetcode.com/problems/single-number/

  2. Add Two Numbers - Given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. https://leetcode.com/problems/add-two-numbers/

Day 9 [April 3]

  1. ZigZag Conversion - Given a string and number of rows, write the string in a zigzag spread across the said number of rows. https://leetcode.com/problems/zigzag-conversion/

  2. Weighted List - Given a nested list of integers, return the sum of all integers in the list weighted by their depth. https://leetcode.com/problems/nested-list-weight-sum/

Day 10 [April 4]

  1. Insert Delete GetRandom - Implement a data structure that does operations insert, delete, and getRandom in O(1) time. https://leetcode.com/problems/insert-delete-getrandom-o1/

  2. Coin Change - How many different ways can you make change for an amount, given a list of coins? https://www.hackerrank.com/challenges/coin-change

Day 11 [April 5]

  1. Merge Intervals - Given a collection of intervals, merge all overlapping intervals. https://leetcode.com/problems/merge-intervals

  2. Group Anagrams - Given an array of strings, group anagrams together. https://leetcode.com/problems/anagrams/

Day 12 [April 6]

  1. Flatten 2D Vector - Implement an iterator to flatten a 2d vector. https://leetcode.com/problems/flatten-2d-vector/

  2. N puzzle - A* search to solve an N puzzle https://www.hackerrank.com/challenges/n-puzzle

Day 13 [April 8]

  1. Invert Binary Tree - invert a binary tree https://leetcode.com/problems/invert-binary-tree/

  2. Find max depth - find max depth of a binary tree https://leetcode.com/problems/maximum-depth-of-binary-tree/

  3. Same tree - given 2 binary trees, check if they're numerically and structurally the same https://leetcode.com/problems/same-tree/

Day 14 [April 10]

  1. Max in a row - You need to find the largest value in each row of a binary tree. https://leetcode.com/problems/find-largest-value-in-each-tree-row/

  2. Find Bottom Left Tree Value - Given a binary tree, find the leftmost value in the last row of the tree. https://leetcode.com/problems/find-bottom-left-tree-value/

  3. Convert BST to Greater Tree - Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST. https://leetcode.com/problems/convert-bst-to-greater-tree/

Day 15 [April 14]

  1. Find leaves of binary tree - Given a binary tree, collect a tree's nodes as if you were doing this: Collect and remove all leaves, repeat until the tree is empty. https://leetcode.com/problems/find-leaves-of-binary-tree/

  2. Happy Num - https://leetcode.com/problems/happy-number/

Day 16 [April 16]

  1. Find Lowest Common Ancestor for BST https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/

Day 17 [April 17]

  1. Quicksort https://www.hackerrank.com/challenges/quicksort3

Day 18 [April 18]

  1. First Bad Version - given a number n, and knowing that if a version is bad then subsequent versions are bad, find the bad version with least number of calls to API isBadVersion(n) https://leetcode.com/problems/first-bad-version/

Day 19 [May 22]

  1. Binary Search Tree Iterator - call next() and hasNext() to iterate over a binary search tree, in ascending order of the values. Has average O(1) run time and O(h) memory where h is height of tree. https://leetcode.com/problems/binary-search-tree-iterator/

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages