062af32e4e
Write a function to find a duplicate item in a list of numbers. The values are in the range [1, n]; the length of the list is n + 1. The solution should run in linear time and consume constant space. The solution is to construct a graph from the list. Each graph will have a cycle where the last element in the cycle is a duplicate value. See the solution for specific techniques on how to compute the length the cycle without infinitely looping.
77 lines
2.2 KiB
Org Mode
77 lines
2.2 KiB
Org Mode
* Array and string manipulation
|
|
** DONE Merging Meeting Times
|
|
** DONE Reverse String in Place
|
|
** DONE Reverse Words
|
|
** DONE Merge Sorted Arrays
|
|
** DONE Cafe Order Checker
|
|
* Hashing and hash tables
|
|
** DONE Inflight Entertainment
|
|
** DONE Permutation Palindrome
|
|
** DONE Word Cloud Data
|
|
** DONE Top Scores
|
|
* Greedy Algorithms
|
|
** DONE Apple Stocks
|
|
** DONE Highest Product of 3
|
|
** DONE Product of All Other Numbers
|
|
** DONE Cafe Order Checker
|
|
** DONE In-Place Shuffle
|
|
* Sorting, searching, and logarithms
|
|
** DONE Find Rotation Point
|
|
** TODO Find Repeat, Space Edition
|
|
** DONE Top Scores
|
|
** DONE Merging Meeting Times
|
|
* Trees and graphs
|
|
** DONE Balanced Binary Tree
|
|
** DONE Binary Search Tree Checker
|
|
** DONE 2nd Largest Item in a Binary Search Tree
|
|
** DONE Graph Coloring
|
|
** DONE MeshMessage
|
|
** DONE Find Repeat, Space Edition BEAST MODE
|
|
* Dynamic programming and recursion
|
|
** TODO Recursive String Permutations
|
|
** TODO Compute nth Fibonacci Number
|
|
** TODO Making Change
|
|
** TODO The Cake Thief
|
|
** DONE Balanced Binary Tree
|
|
** DONE Binary Search Tree Checker
|
|
** DONE 2nd Largest Item in a Binary Search Tree
|
|
* Queues and stacks
|
|
** TODO Largest Stack
|
|
** TODO Implement A Queue With Two Stacks
|
|
** TODO Parenthesis Matching
|
|
** TODO Bracket Validator
|
|
* Linked lists
|
|
** DONE Delete Node
|
|
** TODO Does This Linked List Have A Cycle?
|
|
** TODO Reverse A Linked List
|
|
** TODO Kth to Last Node in a Singly-Linked List
|
|
** DONE Find Repeat, Space Edition BEAST MODE
|
|
* System design
|
|
** TODO URL Shortener
|
|
** TODO MillionGazillion
|
|
** TODO Find Duplicate Files
|
|
* General programming
|
|
** TODO Rectangular Love
|
|
** TODO Temperature Tracker
|
|
* Bit manipulation
|
|
** TODO Binary Numbers
|
|
** TODO The Stolen Breakfast Drone
|
|
* Combinatorics, probability, and other math
|
|
** TODO Which Appears Twice
|
|
** TODO Find in Ordered Set
|
|
** DONE In-Place Shuffle
|
|
** TODO Simulate 5-sided die
|
|
** TODO Simulate 7-sided die
|
|
** TODO Two Egg Problem
|
|
* JavaScript
|
|
** TODO JavaScript Scope
|
|
** TODO What's Wrong with This JavaScript?
|
|
* Coding interview tips
|
|
** TODO How The Coding Interview Works
|
|
** TODO General Coding Interview Advice
|
|
** TODO Impostor Syndrome
|
|
** TODO Why You Hit Dead Ends
|
|
** TODO Tips for Getting Unstuck
|
|
** TODO The 24 Hours Before Your Interview
|
|
** TODO Beating Behavioral Questions
|
|
** TODO Managing Your Interview Timeline
|