Showing preview only (1,397K chars total). Download the full file or copy to clipboard to get everything.
Repository: imteekay/algorithms
Branch: master
Commit: 12008e54efb6
Files: 1561
Total size: 988.9 KB
Directory structure:
gitextract_w21wx358/
├── .github/
│ └── workflows/
│ └── push-ci.yml
├── .gitignore
├── .nvmrc
├── .prettierrc
├── .vscode/
│ └── settings.json
├── FUNDING.yml
├── LICENSE
├── README.md
├── big-o.md
├── coding_interviews/
│ ├── README.md
│ ├── algoexpert/
│ │ ├── README.md
│ │ ├── array-of-products/
│ │ │ ├── array-of-products-optimized.js
│ │ │ └── array-of-products.js
│ │ ├── best-seat/
│ │ │ └── best-seat.js
│ │ ├── binary-search/
│ │ │ └── binary-search.js
│ │ ├── branch-sums/
│ │ │ ├── branch-sums-without-recreating-sums.js
│ │ │ └── branch-sums.js
│ │ ├── bst-construction/
│ │ │ └── bst-construction.js
│ │ ├── bst-traversal/
│ │ │ └── bst-traversal.js
│ │ ├── bubble-sort/
│ │ │ └── bubble-sort.js
│ │ ├── caesar-cipher-encryptor/
│ │ │ └── caesar-cipher-encryptor.js
│ │ ├── class-photos/
│ │ │ └── class-photos.js
│ │ ├── common-characters/
│ │ │ └── common-characters.js
│ │ ├── depth-first-search/
│ │ │ ├── depth-first-search-cleaner.js
│ │ │ └── depth-first-search.js
│ │ ├── evaluate-expression-tree/
│ │ │ ├── evaluate-expression-tree-cleaner.js
│ │ │ ├── evaluate-expression-tree-with-trunc.js
│ │ │ └── evaluate-expression-tree.js
│ │ ├── find-closest-value-in-bst/
│ │ │ ├── find-closest-value-in-bst-optimized-cleaner.js
│ │ │ ├── find-closest-value-in-bst-optimized.js
│ │ │ └── find-closest-value-in-bst.js
│ │ ├── find-three-largest-numbers/
│ │ │ └── find-three-largest-numbers.js
│ │ ├── first-duplicate-value/
│ │ │ ├── first-duplicate-value-optimized.js
│ │ │ └── first-duplicate-value.js
│ │ ├── first-non-repeating-character/
│ │ │ └── first-non-repeating-character.js
│ │ ├── generate-document/
│ │ │ └── generate-document.js
│ │ ├── insertion-sort/
│ │ │ └── insertion-sort.js
│ │ ├── longest-peak/
│ │ │ └── longest-peak.js
│ │ ├── majority-element/
│ │ │ └── majority-element.js
│ │ ├── merge-overlapping-intervals/
│ │ │ └── merge-overlapping-intervals.js
│ │ ├── middle-node/
│ │ │ ├── middle-node-slow-fast.js
│ │ │ └── middle-node.js
│ │ ├── minimum-waiting-time/
│ │ │ └── minimum-waiting-time.js
│ │ ├── missing-numbers/
│ │ │ └── missing-numbers.js
│ │ ├── monotonic-array/
│ │ │ ├── monotonic-array-optimization-1.js
│ │ │ ├── monotonic-array-optimization-2.js
│ │ │ └── monotonic-array.js
│ │ ├── move-element-to-end/
│ │ │ └── move-element-to-end.js
│ │ ├── node-depths/
│ │ │ └── node-depths.js
│ │ ├── non-constructible-change/
│ │ │ └── non-constructible-change.js
│ │ ├── nth-fibonacci/
│ │ │ ├── nth-fibonacci-memo-no-space.js
│ │ │ ├── nth-fibonacci-memo.js
│ │ │ └── nth-fibonacci.js
│ │ ├── optimal-freelancing/
│ │ │ ├── optimal-freelancing-sorting.js
│ │ │ └── optimal-freelancing.js
│ │ ├── palindrome-check/
│ │ │ └── palindrome-check.js
│ │ ├── product-sum/
│ │ │ ├── product-sum-timer-later.js
│ │ │ └── product-sum.js
│ │ ├── remove-duplicates-from-linked-list/
│ │ │ └── remove-duplicates-from-linked-list.js
│ │ ├── remove-islands/
│ │ │ ├── remove-islands-optimized.js
│ │ │ └── remove-islands.js
│ │ ├── run-length-encoding/
│ │ │ ├── run-length-encoding copy.js
│ │ │ ├── run-length-encoding-cleaner.js
│ │ │ └── run-length-encoding.js
│ │ ├── semordnilap/
│ │ │ └── semordnilap.js
│ │ ├── smallest-difference/
│ │ │ └── smallest-difference.js
│ │ ├── sorted-squared-array/
│ │ │ ├── sorted-squared-array-insert-position.js
│ │ │ ├── sorted-squared-array-two-pointers.js
│ │ │ └── sorted-squared-array.js
│ │ ├── spiral-traverse/
│ │ │ └── spiral-traverse.js
│ │ ├── tandem-bicycle/
│ │ │ ├── tandem-bicycle-cleaner.js
│ │ │ └── tandem-bicycle.js
│ │ ├── three-number-sum/
│ │ │ └── three-number-sum.js
│ │ ├── tournament-winner/
│ │ │ ├── tournament-winner-optimized.js
│ │ │ └── tournament-winner.js
│ │ ├── transpose-matrix/
│ │ │ └── transpose-matrix.js
│ │ ├── two-number-sum/
│ │ │ ├── two-number-sum-optimized.js
│ │ │ ├── two-number-sum-two-pointers.js
│ │ │ └── two-number-sum.js
│ │ ├── validate-bst/
│ │ │ └── validate-bst.js
│ │ ├── validate-subsequence/
│ │ │ ├── validate-subsequence-two-pointers.js
│ │ │ └── validate-subsequence.js
│ │ └── zero-sum-subarray/
│ │ ├── zero-sum-subarray-optimized.js
│ │ └── zero-sum-subarray.js
│ ├── algorithms_in_python/
│ │ ├── queue/
│ │ │ └── R-6.7.py
│ │ └── stack/
│ │ ├── R-6.1.py
│ │ ├── R-6.3.py
│ │ ├── R-6.4.py
│ │ └── R-6.5.py
│ ├── blind75/
│ │ └── README.md
│ ├── coding_interview_questions/
│ │ ├── common_elements.py
│ │ ├── decode-string/
│ │ │ ├── decode-string.js
│ │ │ └── tests/
│ │ │ └── decode-string.test.js
│ │ ├── mine_swipper.py
│ │ ├── most_frequently_occurring.py
│ │ ├── non_repeating.py
│ │ ├── nth_element_from_the_end.py
│ │ ├── one_away_strings.py
│ │ ├── optimized_common_elements.py
│ │ ├── rotation_array.py
│ │ └── two-crystal-balls/
│ │ ├── index.js
│ │ └── tests/
│ │ └── index.test.js
│ ├── cracking-the-coding-interview/
│ │ ├── README.md
│ │ ├── big_o/
│ │ │ ├── aditional1.py
│ │ │ ├── aditional2.py
│ │ │ ├── aditional3.py
│ │ │ ├── aditional4.py
│ │ │ ├── aditional5.py
│ │ │ ├── aditional6.py
│ │ │ ├── example1.py
│ │ │ ├── example10.py
│ │ │ ├── example11.py
│ │ │ ├── example12.py
│ │ │ ├── example13.py
│ │ │ ├── example14.py
│ │ │ ├── example15.py
│ │ │ ├── example16.py
│ │ │ ├── example2.py
│ │ │ ├── example3.py
│ │ │ ├── example4.py
│ │ │ ├── example5.py
│ │ │ ├── example6.py
│ │ │ ├── example7.py
│ │ │ └── example9.py
│ │ └── chapter-001/
│ │ ├── check-permutation/
│ │ │ ├── check-permutation.js
│ │ │ └── check-permutation.test.js
│ │ ├── cpp/
│ │ │ └── remove_specified_character.cpp
│ │ ├── is-unique/
│ │ │ ├── is-unique.js
│ │ │ └── is-unique.test.js
│ │ ├── one-away/
│ │ │ ├── one-away.js
│ │ │ └── one-away.test.js
│ │ ├── palindrome-permutation/
│ │ │ ├── palindrome-permutation.js
│ │ │ └── palindrome-permutation.test.js
│ │ ├── python/
│ │ │ ├── 001.01.py
│ │ │ ├── 001.02.py
│ │ │ ├── 001.03.py
│ │ │ ├── 001.04.py
│ │ │ ├── 001.05.py
│ │ │ ├── 001.06.py
│ │ │ ├── 001.07.py
│ │ │ ├── bottlenecks.py
│ │ │ └── is_unique.py
│ │ ├── string-compression/
│ │ │ └── string-compression.js
│ │ └── urlify/
│ │ ├── urlify.js
│ │ └── urlify.test.js
│ ├── daily_code_problems/
│ │ ├── 001.py
│ │ ├── 002.py
│ │ ├── 003.py
│ │ ├── 004.py
│ │ ├── 005.py
│ │ ├── 006.py
│ │ ├── 007.py
│ │ └── README.md
│ ├── elements_of_programming_interview/
│ │ ├── array.py
│ │ ├── base_conversion.py
│ │ ├── buy_and_sell_stock_once.py
│ │ ├── can_reach_end.py
│ │ ├── delete_duplicates_from_a_sorted_array.py
│ │ ├── interconvert_string_and_integer.py
│ │ ├── longest_subarray_length_with_same_integers.py
│ │ ├── multiply_two_arbitrary_precision_integers.py
│ │ └── spreadsheet_column_encoding.py
│ ├── hackerrank_interview_prep_kit/
│ │ ├── hash_tables/
│ │ │ ├── count_triplets.py
│ │ │ ├── ransom_note.py
│ │ │ ├── sherlock_and_anagrams.py
│ │ │ └── two_strings.py
│ │ └── warmup/
│ │ ├── counting_valleys.py
│ │ ├── jumping_on_the_clouds.py
│ │ ├── repeated_string.py
│ │ └── sales_by_match.py
│ ├── interviews/
│ │ ├── fair/
│ │ │ ├── decrementBinaryNumber.js
│ │ │ ├── diceTotalScore.js
│ │ │ ├── isSubmatrixFull.js
│ │ │ └── sortChessSubsquares.js
│ │ ├── google/
│ │ │ └── printSequence/
│ │ │ └── printSequence.js
│ │ ├── mercari/
│ │ │ ├── cumulativeSum.js
│ │ │ ├── findMaxMin.js
│ │ │ ├── findSumPairs.js
│ │ │ ├── multipleDupesArray.js
│ │ │ ├── products.js
│ │ │ ├── removeDupes.js
│ │ │ └── retries.js
│ │ ├── meta/
│ │ │ ├── compareLettersInArray/
│ │ │ │ └── compareLettersInArray.js
│ │ │ └── flatten/
│ │ │ ├── flatten.js
│ │ │ └── flatten2.js
│ │ ├── quintoandar/
│ │ │ ├── quinto1.py
│ │ │ ├── quinto2.py
│ │ │ ├── quinto3.py
│ │ │ └── regions.js
│ │ ├── smartnews/
│ │ │ ├── countries.js
│ │ │ ├── emiter.js
│ │ │ └── getTriplets.js
│ │ └── uber/
│ │ ├── longest-words.js
│ │ ├── maxFrequency.js
│ │ ├── permutations.js
│ │ └── tests/
│ │ └── maxFrequency.test.js
│ ├── javascript/
│ │ ├── array/
│ │ │ ├── binary-search.js
│ │ │ ├── slice.js
│ │ │ └── subarrays.js
│ │ ├── hashmap/
│ │ │ ├── iteration.js
│ │ │ └── object.js
│ │ ├── queue/
│ │ │ └── queue.js
│ │ ├── stack/
│ │ │ └── stack.js
│ │ ├── string/
│ │ │ ├── alphabet.js
│ │ │ ├── charCode.js
│ │ │ ├── isString.js
│ │ │ ├── methods.js
│ │ │ └── sort.js
│ │ └── tree/
│ │ ├── inorder.js
│ │ ├── postorder.js
│ │ └── preorder.js
│ ├── leetcode/
│ │ ├── easy/
│ │ │ ├── a-number-after-a-double-reversal/
│ │ │ │ ├── a-number-after-a-double-reversal.js
│ │ │ │ └── tests/
│ │ │ │ └── a-number-after-a-double-reversal.test.js
│ │ │ ├── add-digits/
│ │ │ │ └── add-digits.js
│ │ │ ├── add-two-integers/
│ │ │ │ └── index.js
│ │ │ ├── alternating-digit-sum/
│ │ │ │ └── alternating-digit-sum.js
│ │ │ ├── apply-operations-to-an-array/
│ │ │ │ └── apply-operations-to-an-array.js
│ │ │ ├── arithmetic_progression/
│ │ │ │ └── arithmetic_progression.py
│ │ │ ├── array_partition.py
│ │ │ ├── average-of-levels-in-binary-tree/
│ │ │ │ └── average-of-levels-in-binary-tree.js
│ │ │ ├── average-salary-excluding-the-minimum-and-maximum-salary/
│ │ │ │ └── average-salary-excluding-the-minimum-and-maximum-salary.js
│ │ │ ├── average-value-of-even-numbers-that-are-divisible-by-three/
│ │ │ │ └── average-value-of-even-numbers-that-are-divisible-by-three.js
│ │ │ ├── backspace-string-compare/
│ │ │ │ ├── index.js
│ │ │ │ └── tests/
│ │ │ │ └── index.test.js
│ │ │ ├── baseball-game/
│ │ │ │ └── baseball-game.js
│ │ │ ├── best-poker-hand/
│ │ │ │ └── best-poker-hand.js
│ │ │ ├── best-time-to-buy-and-sell-stock/
│ │ │ │ ├── best-time-to-buy-and-sell-stock-tle.js
│ │ │ │ └── best-time-to-buy-and-sell-stock.js
│ │ │ ├── binary-number-with-alternating-bits/
│ │ │ │ └── binary-number-with-alternating-bits.js
│ │ │ ├── binary-search/
│ │ │ │ └── binary-search.js
│ │ │ ├── binary-tree-inorder-traversal/
│ │ │ │ └── binary-tree-inorder-traversal.js
│ │ │ ├── binary-tree-paths/
│ │ │ │ └── binary-tree-paths.js
│ │ │ ├── binary-tree-postorder-traversal/
│ │ │ │ └── binary-tree-postorder-traversal.js
│ │ │ ├── binary-tree-preorder-traversal/
│ │ │ │ └── binary-tree-preorder-traversal.js
│ │ │ ├── binary-tree-tilt/
│ │ │ │ ├── binary-tree-tilt-optimized.js
│ │ │ │ └── binary-tree-tilt.js
│ │ │ ├── binary_in_linked_list/
│ │ │ │ └── binary_in_linked_list.py
│ │ │ ├── build_an_array_with_stack_operations/
│ │ │ │ └── build_an_array_with_stack_operations.py
│ │ │ ├── build_array_from_permutation/
│ │ │ │ └── build_array_from_permutation.js
│ │ │ ├── buy-two-chocolates/
│ │ │ │ ├── buy-two-chocolates-on.js
│ │ │ │ ├── buy-two-chocolates-sort.js
│ │ │ │ └── buy-two-chocolates.js
│ │ │ ├── calculate-amount-paid-in-taxes/
│ │ │ │ └── calculate-amount-paid-in-taxes.js
│ │ │ ├── calculate-delayed-arrival-time/
│ │ │ │ └── calculate-delayed-arrival-time.js
│ │ │ ├── calculate-digit-sum-of-a-string/
│ │ │ │ └── calculate-digit-sum-of-a-string.js
│ │ │ ├── calculate-money-in-leetcode-bank/
│ │ │ │ └── calculate-money-in-leetcode-bank.js
│ │ │ ├── can-place-flowers/
│ │ │ │ └── can-place-flowers.js
│ │ │ ├── capitalize-the-title/
│ │ │ │ └── capitalize-the-title.js
│ │ │ ├── cells-in-a-range-on-an-excel-sheet/
│ │ │ │ ├── cells-in-a-range-on-an-excel-sheet.js
│ │ │ │ └── tests/
│ │ │ │ └── cells-in-a-range-on-an-excel-sheet.test.js
│ │ │ ├── check-array-formation-through-concatenation/
│ │ │ │ └── check-array-formation-through-concatenation.js
│ │ │ ├── check-distances-between-same-letters/
│ │ │ │ └── check-distances-between-same-letters.js
│ │ │ ├── check-if-a-string-is-an-acronym-of-words/
│ │ │ │ └── check-if-a-string-is-an-acronym-of-words.js
│ │ │ ├── check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence/
│ │ │ │ └── check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence.js
│ │ │ ├── check-if-all-as-appears-before-all-bs/
│ │ │ │ └── check-if-all-as-appears-before-all-bs.js
│ │ │ ├── check-if-matrix-is-x-matrix/
│ │ │ │ └── check-if-matrix-is-x-matrix.js
│ │ │ ├── check-if-number-has-equal-digit-count-and-digit-value/
│ │ │ │ └── check-if-number-has-equal-digit-count-and-digit-value.js
│ │ │ ├── check-if-numbers-are-ascending-in-a-sentence/
│ │ │ │ └── check-if-numbers-are-ascending-in-a-sentence.js
│ │ │ ├── check-if-the-sentence-is-pangram/
│ │ │ │ └── check-if-the-sentence-is-pangram.py
│ │ │ ├── check-whether-two-strings-are-almost-equivalent/
│ │ │ │ └── check-whether-two-strings-are-almost-equivalent.js
│ │ │ ├── check_if_all_characters_have_equal_number_of_occurrences/
│ │ │ │ └── check_if_all_characters_have_equal_number_of_occurrences.js
│ │ │ ├── check_if_two_string_arrays_are_equivalent/
│ │ │ │ └── check_if_two_string_arrays_are_equivalent.py
│ │ │ ├── circular-sentence/
│ │ │ │ └── circular-sentence.js
│ │ │ ├── climbing-stairs/
│ │ │ │ └── climbing-stairs.js
│ │ │ ├── climbing_stairs.py
│ │ │ ├── concatenation_of_array/
│ │ │ │ └── concatenation_of_array.js
│ │ │ ├── consecutive-characters/
│ │ │ │ └── consecutive-characters.js
│ │ │ ├── construct-string-from-binary-tree/
│ │ │ │ └── construct-string-from-binary-tree.js
│ │ │ ├── contains-duplicate/
│ │ │ │ ├── contains-duplicate-hashmap.js
│ │ │ │ ├── contains-duplicate.js
│ │ │ │ └── contains-duplicate.py
│ │ │ ├── convert-sorted-array-to-binary-search-tree/
│ │ │ │ └── convert-sorted-array-to-binary-search-tree.js
│ │ │ ├── convert-the-temperature/
│ │ │ │ └── convert-the-temperature.js
│ │ │ ├── count-asterisks/
│ │ │ │ └── count-asterisks.js
│ │ │ ├── count-common-words-with-one-occurrence/
│ │ │ │ └── count-common-words-with-one-occurrence.js
│ │ │ ├── count-complete-tree-nodes/
│ │ │ │ └── count-complete-tree-nodes.js
│ │ │ ├── count-equal-and-divisible-pairs-in-an-array/
│ │ │ │ ├── count-equal-and-divisible-pairs-in-an-array-2.js
│ │ │ │ ├── count-equal-and-divisible-pairs-in-an-array.js
│ │ │ │ └── tests/
│ │ │ │ ├── count-equal-and-divisible-pairs-in-an-array-2.test.js
│ │ │ │ └── count-equal-and-divisible-pairs-in-an-array.test.js
│ │ │ ├── count-good-triplets/
│ │ │ │ └── count-good-triplets.py
│ │ │ ├── count-integers-with-even-digit-sum/
│ │ │ │ └── count-integers-with-even-digit-sum.js
│ │ │ ├── count-k-difference/
│ │ │ │ └── count-k-difference.js
│ │ │ ├── count-largest-group/
│ │ │ │ └── count-largest-group.js
│ │ │ ├── count-operations-to-obtain-zero/
│ │ │ │ ├── count-operations-to-obtain-zero.js
│ │ │ │ └── tests/
│ │ │ │ └── count-operations-to-obtain-zero.test.js
│ │ │ ├── count-pairs-of-similar-strings/
│ │ │ │ └── count-pairs-of-similar-strings.js
│ │ │ ├── count-pairs-whose-sum-is-less-than-target/
│ │ │ │ ├── count-pairs-whose-sum-is-less-than-target-two-pointers.js
│ │ │ │ └── count-pairs-whose-sum-is-less-than-target.js
│ │ │ ├── count-prefixes-of-a-given-string/
│ │ │ │ └── count-prefixes-of-a-given-string.js
│ │ │ ├── count-square-sum-triples/
│ │ │ │ └── count-square-sum-triples.js
│ │ │ ├── count-symmetric-integers/
│ │ │ │ └── count-symmetric-integers.js
│ │ │ ├── count-the-digits-that-divide-a-number/
│ │ │ │ └── count-the-digits-that-divide-a-number.js
│ │ │ ├── count-the-number-of-vowel-strings-in-range/
│ │ │ │ └── count-the-number-of-vowel-strings-in-range.js
│ │ │ ├── count-vowel-substrings-of-a-string/
│ │ │ │ └── count-vowel-substrings-of-a-string.js
│ │ │ ├── count_good_rectangles/
│ │ │ │ └── count_good_rectangles.py
│ │ │ ├── count_matches/
│ │ │ │ └── count_matches.py
│ │ │ ├── count_of_matches_in_tournament/
│ │ │ │ └── count_of_matches_in_tournament.py
│ │ │ ├── count_students/
│ │ │ │ └── count_students.py
│ │ │ ├── count_the_number_of_consistent_strings/
│ │ │ │ └── count_the_number_of_consistent_strings.py
│ │ │ ├── counting-bits/
│ │ │ │ └── counting-bits.js
│ │ │ ├── counting-words-with-a-given-prefix/
│ │ │ │ ├── counting-words-with-a-given-prefix.js
│ │ │ │ └── tests/
│ │ │ │ └── counting-words-with-a-given-prefix.test.js
│ │ │ ├── crawler-log-folder/
│ │ │ │ └── crawler-log-folder.js
│ │ │ ├── create_target_array/
│ │ │ │ └── create_target_array.py
│ │ │ ├── decode-the-message/
│ │ │ │ ├── decode-the-message.js
│ │ │ │ └── tests/
│ │ │ │ └── decode-the-message.test.js
│ │ │ ├── decode_xored_array/
│ │ │ │ └── decode_xored_array.py
│ │ │ ├── decompressed_encoded_list/
│ │ │ │ └── decompressed_encoded_list.py
│ │ │ ├── decrypt_string/
│ │ │ │ └── decrypt_string.py
│ │ │ ├── defanging_an_ip_address/
│ │ │ │ └── defanging_an_ip_address.py
│ │ │ ├── defuse-the-bomb/
│ │ │ │ └── defuse-the-bomb.js
│ │ │ ├── delete-greatest-value-in-each-row/
│ │ │ │ └── delete-greatest-value-in-each-row.js
│ │ │ ├── delete_columns_to_make_sorted/
│ │ │ │ └── delete_columns_to_make_sorted.py
│ │ │ ├── design-an-ordered-stream/
│ │ │ │ └── design-an-ordered-stream.js
│ │ │ ├── design-hashmap/
│ │ │ │ └── design-hashmap.js
│ │ │ ├── design-hashset/
│ │ │ │ └── design-hashset.js
│ │ │ ├── design_parking_system/
│ │ │ │ └── design_parking_system.py
│ │ │ ├── destination_city/
│ │ │ │ └── destination_city.py
│ │ │ ├── detect-capital/
│ │ │ │ └── detect-capital.js
│ │ │ ├── determine-if-string-halves-are-alike/
│ │ │ │ └── determine-if-string-halves-are-alike.js
│ │ │ ├── determine_color_of_a_chessboard_square/
│ │ │ │ └── determine_color_of_a_chessboard_square.py
│ │ │ ├── di_string_match/
│ │ │ │ └── di_string_match.py
│ │ │ ├── difference-between-element-sum-and-digit-sum-of-an-array/
│ │ │ │ └── difference-between-element-sum-and-digit-sum-of-an-array.js
│ │ │ ├── discount_price/
│ │ │ │ └── discount_price.py
│ │ │ ├── distribute-candies-among-children-i/
│ │ │ │ ├── distribute-candies-among-children-i.js
│ │ │ │ └── distribute-candies-among-children-ii.js
│ │ │ ├── distribute-candies-to-people/
│ │ │ │ └── distribute-candies-to-people.js
│ │ │ ├── divide-a-string-into-groups-of-size-k/
│ │ │ │ └── divide-a-string-into-groups-of-size-k.js
│ │ │ ├── divide-array-into-equal-pairs/
│ │ │ │ ├── divide-array-into-equal-pairs.js
│ │ │ │ └── tests/
│ │ │ │ └── divide-array-into-equal-pairs.test.js
│ │ │ ├── divisible-and-non-divisible-sums-difference/
│ │ │ │ └── divisible-and-non-divisible-sums-difference.js
│ │ │ ├── divisor-game/
│ │ │ │ └── divisor-game.js
│ │ │ ├── equal_reversed_arrays/
│ │ │ │ └── equal_reversed_arrays.py
│ │ │ ├── evaluate-boolean-binary-tree/
│ │ │ │ └── evaluate-boolean-binary-tree.js
│ │ │ ├── even_digits/
│ │ │ │ └── even_digits.py
│ │ │ ├── excel-sheet-column-number/
│ │ │ │ └── excel-sheet-column-number.js
│ │ │ ├── fair-candy-swap/
│ │ │ │ ├── fair-candy-swap-optimized.js
│ │ │ │ └── fair-candy-swap.js
│ │ │ ├── faulty-keyboard/
│ │ │ │ └── faulty-keyboard.js
│ │ │ ├── fibonacci_number/
│ │ │ │ └── fibonacci_number.py
│ │ │ ├── final-value-after-operations/
│ │ │ │ └── final-value-after-operations.js
│ │ │ ├── find-all-k-distant-indices-in-an-array/
│ │ │ │ └── find-all-k-distant-indices-in-an-array.js
│ │ │ ├── find-all-numbers-disappeared-in-an-array/
│ │ │ │ └── find-all-numbers-disappeared-in-an-array.js
│ │ │ ├── find-center-of-star-graph/
│ │ │ │ └── find-center-of-star-graph.js
│ │ │ ├── find-champion-i/
│ │ │ │ ├── find-champion-i-no-map.js
│ │ │ │ └── find-champion-i.js
│ │ │ ├── find-first-palindromic-string-in-the-array/
│ │ │ │ ├── find-first-palindromic-string-in-the-array.js
│ │ │ │ └── tests/
│ │ │ │ └── find-first-palindromic-string-in-the-array.test.js
│ │ │ ├── find-greatest-common-divisor-of-array/
│ │ │ │ └── find-greatest-common-divisor-of-array.js
│ │ │ ├── find-indices-with-index-and-value-difference-i/
│ │ │ │ └── find-indices-with-index-and-value-difference-i.js
│ │ │ ├── find-lucky-integer-in-an-array/
│ │ │ │ └── find-lucky-integer-in-an-array.js
│ │ │ ├── find-maximum-number-of-string-pairs/
│ │ │ │ └── find-maximum-number-of-string-pairs.js
│ │ │ ├── find-nearest-point-that-has-the-same-x-or-y-coordinate/
│ │ │ │ └── find-nearest-point-that-has-the-same-x-or-y-coordinate.js
│ │ │ ├── find-subarrays-with-equal-sum/
│ │ │ │ └── find-subarrays-with-equal-sum.js
│ │ │ ├── find-target-indices-after-sorting-array/
│ │ │ │ ├── find-target-indices-after-sorting-array.js
│ │ │ │ └── tests/
│ │ │ │ └── find-target-indices-after-sorting-array.test.js
│ │ │ ├── find-the-array-concatenation-value/
│ │ │ │ └── find-the-array-concatenation-value.js
│ │ │ ├── find-the-difference/
│ │ │ │ └── find-the-difference.js
│ │ │ ├── find-the-difference-of-two-arrays/
│ │ │ │ └── find-the-difference-of-two-arrays.js
│ │ │ ├── find-the-distance-value-between-two-arrays/
│ │ │ │ └── find-the-distance-value-between-two-arrays.js
│ │ │ ├── find-the-distinct-difference-array/
│ │ │ │ ├── find-the-distinct-difference-array.js
│ │ │ │ └── optimized-find-the-distinct-difference-array.js
│ │ │ ├── find-the-maximum-achievable-number/
│ │ │ │ └── find-the-maximum-achievable-number.js
│ │ │ ├── find-the-middle-index-in-array/
│ │ │ │ └── find-the-middle-index-in-array.js
│ │ │ ├── find-the-pivot-integer/
│ │ │ │ └── find-the-pivot-integer.js
│ │ │ ├── find-the-width-of-columns-of-a-grid/
│ │ │ │ └── find-the-width-of-columns-of-a-grid.js
│ │ │ ├── find-words-containing-character/
│ │ │ │ └── find-words-containing-character.js
│ │ │ ├── find-words-that-can-be-formed-by-characters/
│ │ │ │ └── find-words-that-can-be-formed-by-characters.js
│ │ │ ├── find_common_characters/
│ │ │ │ └── find_common_characters.py
│ │ │ ├── find_the_highest_altitude/
│ │ │ │ └── find_the_highest_altitude.py
│ │ │ ├── first-bad-version/
│ │ │ │ ├── first-bad-version-binary-search.js
│ │ │ │ └── first-bad-version.js
│ │ │ ├── first-letter-to-appear-twice/
│ │ │ │ └── first-letter-to-appear-twice.js
│ │ │ ├── first-unique-character-in-a-string/
│ │ │ │ └── first-unique-character-in-a-string.js
│ │ │ ├── first_bad_version/
│ │ │ │ └── first_bad_version.py
│ │ │ ├── fizz-buzz/
│ │ │ │ └── fizz-buzz.js
│ │ │ ├── flipping_an_image.py
│ │ │ ├── flood-fill/
│ │ │ │ ├── flood-fill-without-visited.js
│ │ │ │ └── flood-fill.js
│ │ │ ├── furthest-point-from-origin/
│ │ │ │ └── furthest-point-from-origin.js
│ │ │ ├── generate_the_string/
│ │ │ │ └── generate_the_string.py
│ │ │ ├── goal_parser_interpretation/
│ │ │ │ └── goal_parser_interpretation.py
│ │ │ ├── greatest-english-letter-in-upper-and-lower-case/
│ │ │ │ └── greatest-english-letter-in-upper-and-lower-case.js
│ │ │ ├── greatest_candies/
│ │ │ │ └── greatest_candies.py
│ │ │ ├── guess-number-higher-or-lower/
│ │ │ │ └── guess-number-higher-or-lower.js
│ │ │ ├── halves_are_alike/
│ │ │ │ └── halves_are_alike.py
│ │ │ ├── hamming_distance/
│ │ │ │ └── hamming_distance.py
│ │ │ ├── height_checker/
│ │ │ │ └── height_checker.py
│ │ │ ├── implement-queue-using-stacks/
│ │ │ │ └── implement-queue-using-stacks.js
│ │ │ ├── implement-stack-using-queues/
│ │ │ │ └── implement-stack-using-queues.js
│ │ │ ├── increasing_decreasing_string/
│ │ │ │ └── incresing_decreasin_string.py
│ │ │ ├── increasing_order_search_tree/
│ │ │ │ └── increasing_order_search_tree.py
│ │ │ ├── intersection-of-multiple-arrays/
│ │ │ │ └── intersection-of-multiple-arrays.js
│ │ │ ├── intersection-of-two-arrays-ii/
│ │ │ │ └── intersection-of-two-arrays-ii.js
│ │ │ ├── intersection_of_two_arrays/
│ │ │ │ └── intersection_of_two_arrays.py
│ │ │ ├── intersection_of_two_arrays_ii/
│ │ │ │ └── intersection_of_two_arrays.py
│ │ │ ├── invert-binary-tree/
│ │ │ │ └── invert-binary-tree.js
│ │ │ ├── is-subsequence/
│ │ │ │ └── is-subsequence.js
│ │ │ ├── is_palindrome.py
│ │ │ ├── is_sum_equal/
│ │ │ │ └── is_sum_equal.py
│ │ │ ├── island-perimeter/
│ │ │ │ └── island-perimeter.js
│ │ │ ├── jewels_and_stones.py
│ │ │ ├── judge_route_circle.py
│ │ │ ├── judge_route_circle_one_line.py
│ │ │ ├── k-items-with-the-maximum-sum/
│ │ │ │ ├── k-items-with-the-maximum-sum-second.js
│ │ │ │ └── k-items-with-the-maximum-sum.js
│ │ │ ├── keep-multiplying-found-values-by-two/
│ │ │ │ └── keep-multiplying-found-values-by-two.js
│ │ │ ├── keyboard-row/
│ │ │ │ └── keyboard-row.js
│ │ │ ├── kth-distinct-string-in-an-array/
│ │ │ │ └── kth-distinct-string-in-an-array.js
│ │ │ ├── largest-local-values-in-a-matrix/
│ │ │ │ └── largest-local-values-in-a-matrix.js
│ │ │ ├── largest-number-after-digit-swaps-by-parity/
│ │ │ │ └── largest-number-after-digit-swaps-by-parity.js
│ │ │ ├── largest-positive-integer-that-exists-with-its-negative/
│ │ │ │ └── largest-positive-integer-that-exists-with-its-negative.js
│ │ │ ├── last-stone-weight/
│ │ │ │ ├── last-stone-weight.js
│ │ │ │ └── tests/
│ │ │ │ └── last-stone-weight.test.js
│ │ │ ├── last-visited-integers/
│ │ │ │ └── last-visited-integers.js
│ │ │ ├── leaf-similar-trees/
│ │ │ │ └── leaf-similar-trees.js
│ │ │ ├── left-and-right-sum-differences/
│ │ │ │ └── left-and-right-sum-differences.js
│ │ │ ├── length-of-last-word/
│ │ │ │ └── length-of-last-word.js
│ │ │ ├── lexicographically-smallest-palindrome/
│ │ │ │ └── lexicographically-smallest-palindrome.js
│ │ │ ├── linked-list-cycle/
│ │ │ │ └── linked-list-cycle.js
│ │ │ ├── longer-contiguous-segments-of-ones-than-zeros/
│ │ │ │ └── longer-contiguous-segments-of-ones-than-zeros.js
│ │ │ ├── longest-nice-substring/
│ │ │ │ └── longest-nice-substring.js
│ │ │ ├── longest-subsequence-with-limited-sum/
│ │ │ │ └── longest-subsequence-with-limited-sum.js
│ │ │ ├── longest_palindrome.py
│ │ │ ├── lowest-common-ancestor-of-a-binary-search-tree/
│ │ │ │ └── lowest-common-ancestor-of-a-binary-search-tree.js
│ │ │ ├── lucky_numbers_in_a_matrix/
│ │ │ │ └── lucky_numbers_in_a_matrix.py
│ │ │ ├── majority-element/
│ │ │ │ └── majority-element.js
│ │ │ ├── make-array-zero-by-subtracting-equal-amounts/
│ │ │ │ └── make-array-zero-by-subtracting-equal-amounts.js
│ │ │ ├── make-the-string-great/
│ │ │ │ └── make-the-string-great.js
│ │ │ ├── matrix-cells-in-distance-order/
│ │ │ │ └── matrix-cells-in-distance-order.js
│ │ │ ├── matrix_diagonal_sum/
│ │ │ │ └── matrix_diagonal_sum.py
│ │ │ ├── matrix_negative_numbers/
│ │ │ │ └── matrix_negative_numbers.py
│ │ │ ├── max-consecutive-ones/
│ │ │ │ └── max-consecutive-ones.js
│ │ │ ├── maximum-69-number/
│ │ │ │ └── maximum-69-number.js
│ │ │ ├── maximum-ascending-subarray-sum/
│ │ │ │ └── maximum-ascending-subarray-sum.js
│ │ │ ├── maximum-count-of-positive-integer-and-negative-integer/
│ │ │ │ └── maximum-count-of-positive-integer-and-negative-integer.js
│ │ │ ├── maximum-depth-of-binary-tree/
│ │ │ │ ├── maximum-depth-of-binary-tree-2.js
│ │ │ │ └── maximum-depth-of-binary-tree.js
│ │ │ ├── maximum-depth-of-n-ary-tree/
│ │ │ │ └── maximum-depth-of-n-ary-tree.js
│ │ │ ├── maximum-number-of-balloons/
│ │ │ │ └── maximum-number-of-balloons.js
│ │ │ ├── maximum-number-of-pairs-in-array/
│ │ │ │ └── maximum-number-of-pairs-in-array.js
│ │ │ ├── maximum-odd-binary-number/
│ │ │ │ └── maximum-odd-binary-number.js
│ │ │ ├── maximum-subarray/
│ │ │ │ └── maximum-subarray.js
│ │ │ ├── maximum-sum-with-exactly-k-elements/
│ │ │ │ └── maximum-sum-with-exactly-k-elements.js
│ │ │ ├── maximum-units-on-a-truck/
│ │ │ │ └── maximum-units-on-a-truck.py
│ │ │ ├── maximum-value-of-a-string-in-an-array/
│ │ │ │ └── maximum-value-of-a-string-in-an-array.js
│ │ │ ├── maximum_nesting_depth_of_the_parentheses/
│ │ │ │ └── maximum_nesting_depth_of_the_parentheses.py
│ │ │ ├── maximum_number_of_balls_in_a_box/
│ │ │ │ └── maximum_number_of_balls_in_a_box.py
│ │ │ ├── maximum_number_of_words_you_can_type/
│ │ │ │ └── maximum_number_of_words_you_can_type.js
│ │ │ ├── maximum_population/
│ │ │ │ └── maximum_population.py
│ │ │ ├── maximum_product/
│ │ │ │ └── maximum_product.py
│ │ │ ├── maximum_product_difference_between_two_pairs/
│ │ │ │ └── maximum_product_difference_between_two_pairs.js
│ │ │ ├── mean-of-array-after-removing-some-elements/
│ │ │ │ └── mean-of-array-after-removing-some-elements.js
│ │ │ ├── merge-nodes-in-between-zeros/
│ │ │ │ ├── merge-nodes-in-between-zeros.js
│ │ │ │ └── tests/
│ │ │ │ └── merge-nodes-in-between-zeros.test.js
│ │ │ ├── merge-similar-items/
│ │ │ │ └── merge-similar-items.js
│ │ │ ├── merge-sorted-array/
│ │ │ │ └── merge-sorted-array.js
│ │ │ ├── merge-two-2d-arrays-by-summing-values/
│ │ │ │ └── merge-two-2d-arrays-by-summing-values.js
│ │ │ ├── merge-two-binary-trees/
│ │ │ │ └── merge-two-binary-trees.js
│ │ │ ├── merge-two-sorted-lists/
│ │ │ │ ├── merge-two-sorted-lists.js
│ │ │ │ └── tests/
│ │ │ │ └── merge-two-sorted-lists.test.js
│ │ │ ├── merge_strings_alternately/
│ │ │ │ └── merge_strings_alternately.py
│ │ │ ├── merge_trees.py
│ │ │ ├── merge_two_lists.py
│ │ │ ├── middle-of-the-linked-list/
│ │ │ │ ├── middle-of-the-linked-list-fast-slow.js
│ │ │ │ └── middle-of-the-linked-list.js
│ │ │ ├── min-max-game/
│ │ │ │ └── min-max-game.js
│ │ │ ├── minimize-string-length/
│ │ │ │ └── minimize-string-length.js
│ │ │ ├── minimum-absolute-difference/
│ │ │ │ └── minimum-absolute-difference.js
│ │ │ ├── minimum-absolute-difference-in-bst/
│ │ │ │ └── minimum-absolute-difference-in-bst.js
│ │ │ ├── minimum-bit-flips-to-convert-number/
│ │ │ │ ├── minimum-bit-flips-to-convert-number.js
│ │ │ │ └── tests/
│ │ │ │ └── minimum-bit-flips-to-convert-number.test.js
│ │ │ ├── minimum-cost-to-move-chips-to-the-same-position/
│ │ │ │ └── minimum-cost-to-move-chips-to-the-same-position.js
│ │ │ ├── minimum-depth-of-binary-tree/
│ │ │ │ └── minimum-depth-of-binary-tree.js
│ │ │ ├── minimum-distance-between-bst-nodes/
│ │ │ │ └── minimum-distance-between-bst-nodes.js
│ │ │ ├── minimum-number-game/
│ │ │ │ └── minimum-number-game.js
│ │ │ ├── minimum-number-of-moves-to-seat-everyone/
│ │ │ │ ├── minimum-number-of-moves-to-seat-everyone.js
│ │ │ │ └── tests/
│ │ │ │ └── minimum-number-of-moves-to-seat-everyone.test.js
│ │ │ ├── minimum-number-of-operations-to-convert-time/
│ │ │ │ └── minimum-number-of-operations-to-convert-time.js
│ │ │ ├── minimum-string-length-after-removing-substrings/
│ │ │ │ └── minimum-string-length-after-removing-substrings.js
│ │ │ ├── minimum-subsequence-in-non-increasing-order/
│ │ │ │ └── minimum-subsequence-in-non-increasing-order.js
│ │ │ ├── minimum-sum/
│ │ │ │ └── minimum-sum.js
│ │ │ ├── minimum-sum-of-mountain-triplets-i/
│ │ │ │ └── minimum-sum-of-mountain-triplets-i.js
│ │ │ ├── minimum-time-to-type-word-using-special-typewriter/
│ │ │ │ └── minimum-time-to-type-word-using-special-typewriter.js
│ │ │ ├── minimum-value-to-get-positive-step-by-step-sum/
│ │ │ │ └── minimum-value-to-get-positive-step-by-step-sum.js
│ │ │ ├── minimum_operations_to_make_the_array_increasing/
│ │ │ │ └── minimum_operations_to_make_the_array_increasing.py
│ │ │ ├── missing-number/
│ │ │ │ └── missing-number.js
│ │ │ ├── monotonic-array/
│ │ │ │ └── monotonic-array.js
│ │ │ ├── most-words-found/
│ │ │ │ └── most-words-found.js
│ │ │ ├── move-zeroes/
│ │ │ │ ├── move-zeroes-in-place.js
│ │ │ │ └── move-zeroes.js
│ │ │ ├── n_ary_tree_postorder_traversal/
│ │ │ │ └── n_ary_tree_postorder_traversal.py
│ │ │ ├── n_ary_tree_preorder_traversal/
│ │ │ │ └── n_ary_tree_preorder_traversal.py
│ │ │ ├── n_repeated_element_in_size_2n_array/
│ │ │ │ └── n_repeated_element_in_size_2n_array.py
│ │ │ ├── neither-minimum-nor-maximum/
│ │ │ │ ├── neither-minimum-nor-maximum-on.js
│ │ │ │ └── neither-minimum-nor-maximum.js
│ │ │ ├── next-greater-element-i/
│ │ │ │ ├── next-greater-element-i-optimized.js
│ │ │ │ ├── next-greater-element-i.js
│ │ │ │ └── tests/
│ │ │ │ ├── next-greater-element-i-optimized.test.js
│ │ │ │ └── next-greater-element-i.test.js
│ │ │ ├── num_unique_emails/
│ │ │ │ └── num_unique_emails.py
│ │ │ ├── number-of-1-bits/
│ │ │ │ └── number-of-1-bits.js
│ │ │ ├── number-of-arithmetic-triplets/
│ │ │ │ └── number-of-arithmetic-triplets.js
│ │ │ ├── number-of-common-factors/
│ │ │ │ └── number-of-common-factors.js
│ │ │ ├── number-of-employees-who-met-the-target/
│ │ │ │ └── number-of-employees-who-met-the-target.js
│ │ │ ├── number-of-even-and-odd-bits/
│ │ │ │ └── number-of-even-and-odd-bits.js
│ │ │ ├── number-of-lines-to-write-string/
│ │ │ │ └── number-of-lines-to-write-string.js
│ │ │ ├── number-of-senior-citizens/
│ │ │ │ ├── number-of-senior-citizens.js
│ │ │ │ └── one-liner-number-of-senior-citizens.js
│ │ │ ├── number-of-strings-that-appear-as-substrings-in-word/
│ │ │ │ └── number-of-strings-that-appear-as-substrings-in-word.js
│ │ │ ├── number-of-unequal-triplets-in-array/
│ │ │ │ └── number-of-unequal-triplets-in-array.js
│ │ │ ├── number_complement.py
│ │ │ ├── number_of_good_pairs/
│ │ │ │ └── number_of_good_pairs.py
│ │ │ ├── number_of_recent_calls/
│ │ │ │ └── number_of_recent_calls.py
│ │ │ ├── number_of_students/
│ │ │ │ └── number_of_students.py
│ │ │ ├── odd-string-difference/
│ │ │ │ └── odd-string-difference.js
│ │ │ ├── odd_in_matrix/
│ │ │ │ └── odd_in_matrix.py
│ │ │ ├── partition_labels.py
│ │ │ ├── pascals-triangle/
│ │ │ │ └── pascals-triangle.js
│ │ │ ├── path-sum/
│ │ │ │ └── path-sum.js
│ │ │ ├── peak_index_mountain.py
│ │ │ ├── percentage-of-letter-in-string/
│ │ │ │ └── percentage-of-letter-in-string.js
│ │ │ ├── plus_one/
│ │ │ │ ├── plus_one.js
│ │ │ │ └── plus_one.py
│ │ │ ├── points-that-intersect-with-cars/
│ │ │ │ └── points-that-intersect-with-cars.js
│ │ │ ├── power-of-two/
│ │ │ │ └── power-of-two.js
│ │ │ ├── prime-number-of-set-bits-in-binary-representation/
│ │ │ │ └── prime-number-of-set-bits-in-binary-representation.js
│ │ │ ├── projection-area-of-3d-shapes/
│ │ │ │ └── projection-area-of-3d-shapes.js
│ │ │ ├── range_sum_of_bst/
│ │ │ │ └── range_sum_of_bst.py
│ │ │ ├── rank-transform-of-an-array/
│ │ │ │ ├── rank-transform-of-an-array-less-memory.js
│ │ │ │ └── rank-transform-of-an-array.js
│ │ │ ├── ransom-note/
│ │ │ │ └── ransom-note.js
│ │ │ ├── ransom_note/
│ │ │ │ └── ransom_note.py
│ │ │ ├── reduce_zero/
│ │ │ │ └── reduce_zero.py
│ │ │ ├── reformat-date/
│ │ │ │ └── reformat-date.js
│ │ │ ├── reformat-phone-number/
│ │ │ │ └── reformat-phone-number.js
│ │ │ ├── relative-ranks/
│ │ │ │ └── relative-ranks.js
│ │ │ ├── relative-sort-array/
│ │ │ │ └── relative-sort-array.js
│ │ │ ├── remove-duplicates-from-sorted-list/
│ │ │ │ └── remove-duplicates-from-sorted-list.js
│ │ │ ├── remove-linked-list-elements/
│ │ │ │ └── remove-linked-list-elements.js
│ │ │ ├── remove-outermost-parentheses/
│ │ │ │ ├── remove-outermost-parentheses.js
│ │ │ │ └── tests/
│ │ │ │ └── remove-outermost-parentheses.test.js
│ │ │ ├── remove-palindromic-subsequences/
│ │ │ │ └── remove-palindromic-subsequences.js
│ │ │ ├── remove-trailing-zeros-from-a-string/
│ │ │ │ └── remove-trailing-zeros-from-a-string.js
│ │ │ ├── remove_duplicates/
│ │ │ │ └── remove_duplicates.py
│ │ │ ├── remove_duplicates.py
│ │ │ ├── remove_duplicates_from_list.py
│ │ │ ├── remove_element.py
│ │ │ ├── replace_digits/
│ │ │ │ └── replace_digits.py
│ │ │ ├── replace_elements/
│ │ │ │ └── replace_elements.py
│ │ │ ├── reshape-the-matrix/
│ │ │ │ └── reshape-the-matrix.js
│ │ │ ├── reverse-linked-list/
│ │ │ │ └── reverse-linked-list.js
│ │ │ ├── reverse-only-letters/
│ │ │ │ └── reverse-only-letters.js
│ │ │ ├── reverse-prefix-of-word/
│ │ │ │ ├── reverse-prefix-of-word.js
│ │ │ │ └── tests/
│ │ │ │ └── reverse-prefix-of-word.test.js
│ │ │ ├── reverse-string/
│ │ │ │ ├── reverse-string-in-place.js
│ │ │ │ └── reverse-string.js
│ │ │ ├── reverse-vowels-of-a-string/
│ │ │ │ └── reverse-vowels-of-a-string.js
│ │ │ ├── reverse-words-in-a-string-iii/
│ │ │ │ └── reverse-words-in-a-string-iii.js
│ │ │ ├── reverse_integer.py
│ │ │ ├── reverse_string.py
│ │ │ ├── reverse_vowels.py
│ │ │ ├── reverse_words_string.py
│ │ │ ├── rings-and-rods/
│ │ │ │ ├── rings-and-rods.js
│ │ │ │ └── tests/
│ │ │ │ └── rings-and-rods.test.js
│ │ │ ├── root-equals-sum-of-children/
│ │ │ │ └── index.js
│ │ │ ├── row-with-maximum-ones/
│ │ │ │ └── row-with-maximum-ones.js
│ │ │ ├── running_array_sum/
│ │ │ │ └── running_array_sum.py
│ │ │ ├── same-tree/
│ │ │ │ └── same-tree.js
│ │ │ ├── same_tree.py
│ │ │ ├── search-in-a-binary-search-tree/
│ │ │ │ └── search-in-a-binary-search-tree.js
│ │ │ ├── search-insert-position/
│ │ │ │ ├── search-insert-position-new.js
│ │ │ │ └── search-insert-position.js
│ │ │ ├── search_in_a_binary_search_tree/
│ │ │ │ └── search_in_a_binary_search_tree.py
│ │ │ ├── second-largest-digit-in-a-string/
│ │ │ │ └── second-largest-digit-in-a-string.js
│ │ │ ├── self_dividing_numbers.py
│ │ │ ├── semi-ordered-permutation/
│ │ │ │ └── semi-ordered-permutation.js
│ │ │ ├── separate-the-digits-in-an-array/
│ │ │ │ └── separate-the-digits-in-an-array.js
│ │ │ ├── shortest_to_char/
│ │ │ │ └── shortest_to_char.py
│ │ │ ├── shuffle_string/
│ │ │ │ └── shuffle_string.py
│ │ │ ├── shuffle_the_array/
│ │ │ │ └── shuffle_the_array.py
│ │ │ ├── sign_of_the_product_of_an_array/
│ │ │ │ └── sign_of_the_product_of_an_array.py
│ │ │ ├── single-number/
│ │ │ │ └── single-number.js
│ │ │ ├── single_number/
│ │ │ │ └── single_number.py
│ │ │ ├── slowest-key/
│ │ │ │ └── slowest-key.js
│ │ │ ├── smallest-even-multiple/
│ │ │ │ └── smallest-even-multiple.js
│ │ │ ├── smallest-index-with-equal-value/
│ │ │ │ └── smallest-index-with-equal-value.js
│ │ │ ├── smallest-range-i/
│ │ │ │ ├── optimized-smallest-range-i.js
│ │ │ │ ├── smallest-range-i.js
│ │ │ │ └── smallest-range-iI.js
│ │ │ ├── smallest_numbers/
│ │ │ │ └── smallest_numbers.py
│ │ │ ├── sort-array-by-increasing-frequency/
│ │ │ │ └── sort-array-by-increasing-frequency.js
│ │ │ ├── sort-array-by-parity/
│ │ │ │ ├── sort-array-by-parity-two-loops.js
│ │ │ │ └── sort-array-by-parity.js
│ │ │ ├── sort-array-by-parity-ii/
│ │ │ │ ├── sort-array-by-parity-ii.js
│ │ │ │ └── tests/
│ │ │ │ └── sort-array-by-parity-ii.test.js
│ │ │ ├── sort-even-and-odd-indices-independently/
│ │ │ │ └── sort-even-and-odd-indices-independently.js
│ │ │ ├── sort-integers-by-the-number-of-1-bits/
│ │ │ │ └── sort-integers-by-the-number-of-1-bits.js
│ │ │ ├── sort-the-people/
│ │ │ │ └── sort-the-people.js
│ │ │ ├── sort_array_by_parity/
│ │ │ │ └── sort_array_by_parity.py
│ │ │ ├── sort_sentence/
│ │ │ │ └── sort_sentence.py
│ │ │ ├── special-positions-in-a-binary-matrix/
│ │ │ │ ├── special-positions-in-a-binary-matrix-cache.js
│ │ │ │ └── special-positions-in-a-binary-matrix.js
│ │ │ ├── split-strings-by-separator/
│ │ │ │ └── split-strings-by-separator.js
│ │ │ ├── split-with-minimum-sum/
│ │ │ │ └── split-with-minimum-sum.js
│ │ │ ├── split_string_in_balanced_strings/
│ │ │ │ └── split_string_in_balanced_strings.py
│ │ │ ├── squares-of-a-sorted-array/
│ │ │ │ ├── squares-of-a-sorted-array-on.js
│ │ │ │ └── squares-of-a-sorted-array.js
│ │ │ ├── squares_of_a_sorted_array/
│ │ │ │ └── squares_of_a_sorted_array.py
│ │ │ ├── str_str/
│ │ │ │ └── str_str.py
│ │ │ ├── string-matching-in-an-array/
│ │ │ │ └── string-matching-in-an-array.js
│ │ │ ├── subarrays-distinct-element-sum-of-squares-i/
│ │ │ │ └── subarrays-distinct-element-sum-of-squares-i.js
│ │ │ ├── subdomain_visit_count.py
│ │ │ ├── substrings-of-size-three-with-distinct-characters/
│ │ │ │ └── substrings-of-size-three-with-distinct-characters.js
│ │ │ ├── subtract_product_and_sum/
│ │ │ │ └── subtract_product_and_sum.py
│ │ │ ├── subtree-of-another-tree/
│ │ │ │ └── subtree-of-another-tree.js
│ │ │ ├── sum-multiples/
│ │ │ │ └── sum-multiples.js
│ │ │ ├── sum-of-all-subset-xor-totals/
│ │ │ │ └── sum-of-all-subset-xor-totals.js
│ │ │ ├── sum-of-digits-in-base-k/
│ │ │ │ └── sum-of-digits-in-base-k.js
│ │ │ ├── sum-of-digits-of-string-after-convert/
│ │ │ │ └── sum-of-digits-of-string-after-convert.js
│ │ │ ├── sum-of-left-leaves/
│ │ │ │ └── sum-of-left-leaves.js
│ │ │ ├── sum-of-squares-of-special-elements/
│ │ │ │ └── sum-of-squares-of-special-elements.js
│ │ │ ├── sum-of-values-at-indices-with-k-set-bits/
│ │ │ │ └── sum-of-values-at-indices-with-k-set-bits.js
│ │ │ ├── sum_leaf_binary_numbers/
│ │ │ │ └── sum_leaf_binary_numbers.py
│ │ │ ├── sum_of_all_odd_length_subarrays/
│ │ │ │ └── sum_of_all_odd_length_subarrays.py
│ │ │ ├── sum_of_unique_elements/
│ │ │ │ └── sum_of_unique_elements.py
│ │ │ ├── sum_zero/
│ │ │ │ └── sum_zero.py
│ │ │ ├── symmetric-tree/
│ │ │ │ └── symmetric-tree.js
│ │ │ ├── take-gifts-from-the-richest-pile/
│ │ │ │ └── take-gifts-from-the-richest-pile.js
│ │ │ ├── three-consecutive-odds/
│ │ │ │ └── three-consecutive-odds.js
│ │ │ ├── time-needed-to-buy-tickets/
│ │ │ │ └── time-needed-to-buy-tickets.js
│ │ │ ├── to_lower_case/
│ │ │ │ └── to_lower_case.py
│ │ │ ├── toeplitz-matrix/
│ │ │ │ └── toeplitz-matrix.js
│ │ │ ├── transpose-matrix/
│ │ │ │ └── transpose-matrix.js
│ │ │ ├── truncate_sentence/
│ │ │ │ └── truncate_sentence.py
│ │ │ ├── two-furthest-houses-with-different-colors/
│ │ │ │ └── two-furthest-houses-with-different-colors.js
│ │ │ ├── two-out-of-three/
│ │ │ │ └── two-out-of-three.js
│ │ │ ├── two-sum/
│ │ │ │ └── two-sum.js
│ │ │ ├── two-sum-iv-input-is-a-bst/
│ │ │ │ └── two-sum-iv-input-is-a-bst.js
│ │ │ ├── two_sum.py
│ │ │ ├── uncommon-words-from-two-sentences/
│ │ │ │ └── uncommon-words-from-two-sentences.js
│ │ │ ├── unique-number-of-occurrences/
│ │ │ │ └── unique-number-of-occurrences.js
│ │ │ ├── unique_morse_code_words.py
│ │ │ ├── unique_number_of_occurrences/
│ │ │ │ └── unique_number_of_occurrences.py
│ │ │ ├── univalued-binary-tree/
│ │ │ │ └── univalued-binary-tree.js
│ │ │ ├── valid-anagram/
│ │ │ │ └── valid-anagram.js
│ │ │ ├── valid-palindrome/
│ │ │ │ ├── valid-palindrome-2.js
│ │ │ │ ├── valid-palindrome.js
│ │ │ │ └── valid_palindrome.py
│ │ │ ├── valid-parentheses/
│ │ │ │ └── valid-parentheses.js
│ │ │ ├── water-bottles/
│ │ │ │ └── water-bottles.js
│ │ │ ├── weakest_rows/
│ │ │ │ └── weakest_rows.py
│ │ │ └── xor-operation-in-an-array/
│ │ │ └── xor-operation-in-an-array.js
│ │ └── medium/
│ │ ├── 3sum/
│ │ │ └── 3sum-tle.js
│ │ ├── add_two_numbers/
│ │ │ └── add_two_numbers.py
│ │ ├── all_elements_in_two_binary_search_trees/
│ │ │ └── all_elements_in_two_binary_search_trees.py
│ │ ├── arithmetic-subarrays/
│ │ │ └── arithmetic-subarrays.py
│ │ ├── balance-a-binary-search-tree/
│ │ │ └── balance-a-binary-search-tree.js
│ │ ├── binary-tree-inorder-traversal/
│ │ │ └── binary-tree-inorder-traversal.py
│ │ ├── binary-tree-level-order-traversal/
│ │ │ └── binary-tree-level-order-traversal.js
│ │ ├── bst_from_pre_order_traversal/
│ │ │ └── bst_from_pre_order_traversal.py
│ │ ├── bst_to_greatest/
│ │ │ └── bst_to_greatest.py
│ │ ├── clone-graph/
│ │ │ └── clone-graph.js
│ │ ├── cloned_binary_tree/
│ │ │ └── cloned_binary_tree.py
│ │ ├── count-nodes-equal-to-average-of-subtree/
│ │ │ └── count-nodes-equal-to-average-of-subtree.js
│ │ ├── count-number-of-distinct-integers-after-reverse-operations/
│ │ │ ├── count-number-of-distinct-integers-after-reverse-operations-numbers.js
│ │ │ └── count-number-of-distinct-integers-after-reverse-operations.js
│ │ ├── count-sorted-vowel-strings/
│ │ │ └── count-sorted-vowel-strings.js
│ │ ├── count-sub-islands/
│ │ │ ├── count-sub-islands-tle.js
│ │ │ └── count-sub-islands.js
│ │ ├── count_points/
│ │ │ └── count_points.py
│ │ ├── counter_number_of_teams/
│ │ │ └── counter_number_of_teams.py
│ │ ├── deck_revealed_increasing/
│ │ │ └── deck_revealed_increasing.py
│ │ ├── decode-string/
│ │ │ ├── decode-string.js
│ │ │ └── tests/
│ │ │ └── decode-string.test.js
│ │ ├── deepest_leaves_sum/
│ │ │ └── deepest_leaves_sum.py
│ │ ├── delete-node-in-a-linked-list/
│ │ │ ├── better-delete-node-in-a-linked-list.js
│ │ │ └── delete-node-in-a-linked-list.js
│ │ ├── design-a-stack-with-increment-operation/
│ │ │ ├── design-a-stack-with-increment-operation.js
│ │ │ └── tests/
│ │ │ └── design-a-stack-with-increment-operation.test.js
│ │ ├── design-add-and-search-words-data-structure/
│ │ │ └── design-add-and-search-words-data-structure.js
│ │ ├── difference-between-ones-and-zeros-in-row-and-column/
│ │ │ └── difference-between-ones-and-zeros-in-row-and-column.js
│ │ ├── encode_and_decode_tinyurl/
│ │ │ └── encode_and_decode_tinyurl.py
│ │ ├── execution-of-all-suffix-instructions-staying-in-a-grid/
│ │ │ └── execution-of-all-suffix-instructions-staying-in-a-grid.js
│ │ ├── find-the-original-array-of-prefix-xor/
│ │ │ ├── README.md
│ │ │ └── find-the-original-array-of-prefix-xor.js
│ │ ├── find-the-winner-of-the-circular-game/
│ │ │ ├── find-the-winner-of-the-circular-game.js
│ │ │ └── queue-find-the-winner-of-the-circular-game.js
│ │ ├── find-triangular-sum-of-an-array/
│ │ │ ├── find-triangular-sum-of-an-array.js
│ │ │ └── tests/
│ │ │ └── find-triangular-sum-of-an-array.test.js
│ │ ├── find-valid-matrix-given-row-and-column-sums/
│ │ │ └── find-valid-matrix-given-row-and-column-sums.js
│ │ ├── find_and_replace_pattern/
│ │ │ └── find_and_replace_pattern.py
│ │ ├── finding_pairs_with_a_certain_sum/
│ │ │ └── finding_pairs_with_a_certain_sum.py
│ │ ├── finding_the_users_active_minutes/
│ │ │ └── finding_the_users_active_minutes.py
│ │ ├── fraction_to_decimal/
│ │ │ └── fraction_to_decimal.py
│ │ ├── group-anagrams/
│ │ │ └── group-anagrams.js
│ │ ├── group_the_people/
│ │ │ └── group_the_people.py
│ │ ├── insert-greatest-common-divisors-in-linked-list/
│ │ │ └── insert-greatest-common-divisors-in-linked-list.js
│ │ ├── insert-into-a-binary-search-tree/
│ │ │ └── insert-into-a-binary-search-tree.js
│ │ ├── insert_bst/
│ │ │ └── insert_bst.py
│ │ ├── keep_city_skyline/
│ │ │ └── keep_city_skyline.py
│ │ ├── kth-smallest-element-in-a-bst/
│ │ │ ├── kth-smallest-element-in-a-bst-1.js
│ │ │ ├── kth-smallest-element-in-a-bst-2.js
│ │ │ └── kth-smallest-element-in-a-bst.js
│ │ ├── letter_tile_possibilities/
│ │ │ └── letter_tile_possibilities.py
│ │ ├── longest-substring-without-repeating-characters/
│ │ │ └── longest-substring-without-repeating-characters.js
│ │ ├── max-area-of-island/
│ │ │ └── max-area-of-island.js
│ │ ├── max_coins/
│ │ │ └── max_coins.py
│ │ ├── maximum-sum-of-an-hourglass/
│ │ │ └── maximum-sum-of-an-hourglass.js
│ │ ├── maximum_binary_tree/
│ │ │ └── maximum_binary_tree.py
│ │ ├── median_tree/
│ │ │ └── median_tree.py
│ │ ├── merge-nodes-in-between-zeros/
│ │ │ ├── merge-nodes-in-between-zeros.js
│ │ │ └── tests/
│ │ │ └── merge-nodes-in-between-zeros.test.js
│ │ ├── min-cost-climbing-stairs/
│ │ │ └── min-cost-climbing-stairs.js
│ │ ├── min_operations/
│ │ │ └── min_operations.py
│ │ ├── min_pair_sum/
│ │ │ └── min_pair_sum.py
│ │ ├── min_partitions/
│ │ │ └── min_partitions.py
│ │ ├── minimum-add-to-make-parentheses-valid/
│ │ │ └── minimum-add-to-make-parentheses-valid.js
│ │ ├── minimum-amount-of-time-to-collect-garbage/
│ │ │ └── minimum-amount-of-time-to-collect-garbage.js
│ │ ├── minimum-cost-of-buying-candies-with-discount/
│ │ │ └── minimum-cost-of-buying-candies-with-discount.js
│ │ ├── minimum-number-of-steps-to-make-two-strings-anagram/
│ │ │ ├── README.md
│ │ │ └── minimum-number-of-steps-to-make-two-strings-anagram.js
│ │ ├── minimum_number_of_operations_to_move_all_balls_to_each_box/
│ │ │ └── minimum_number_of_operations_to_move_all_balls_to_each_box.py
│ │ ├── number-of-closed-islands/
│ │ │ └── number-of-closed-islands.js
│ │ ├── number-of-enclaves/
│ │ │ └── number-of-enclaves.js
│ │ ├── number-of-islands/
│ │ │ └── number-of-islands.js
│ │ ├── number-of-laser-beams-in-a-bank/
│ │ │ ├── number-of-laser-beams-in-a-bank.js
│ │ │ └── tests/
│ │ │ └── number-of-laser-beams-in-a-bank.test.js
│ │ ├── optimal-partition-of-string/
│ │ │ ├── optimal-partition-of-string.js
│ │ │ └── optimized-optimal-partition-of-string.js
│ │ ├── pair-sum/
│ │ │ ├── pair-sum.js
│ │ │ └── tests/
│ │ │ └── pair-sum.test.js
│ │ ├── partition-array-according-to-given-pivot/
│ │ │ ├── partition-array-according-to-given-pivot.js
│ │ │ └── tests/
│ │ │ └── partition-array-according-to-given-pivot.test.js
│ │ ├── permutation-in-string/
│ │ │ ├── permutation-in-string-sliding-window.js
│ │ │ └── permutation-in-string.js
│ │ ├── populating-next-right-pointers-in-each-node/
│ │ │ ├── populating-next-right-pointers-in-each-node-simpler.js
│ │ │ └── populating-next-right-pointers-in-each-node.js
│ │ ├── process_queries/
│ │ │ └── process_queries.py
│ │ ├── product-of-array-except-self/
│ │ │ └── product-of-array-except-self.js
│ │ ├── rearrange-array-elements-by-sign/
│ │ │ ├── rearrange-array-elements-by-sign.js
│ │ │ └── tests/
│ │ │ └── rearrange-array-elements-by-sign.test.js
│ │ ├── reduce_array_size_to_the_half/
│ │ │ └── reduce_array_size_to_the_half.py
│ │ ├── remove-nth-node-from-end-of-list/
│ │ │ ├── remove-nth-node-from-end-of-list-fast-slow.js
│ │ │ └── remove-nth-node-from-end-of-list.js
│ │ ├── rotate-array/
│ │ │ ├── rotate-array-optimized.js
│ │ │ └── rotate-array.js
│ │ ├── rotate-image/
│ │ │ └── rotate-image.js
│ │ ├── search-a-2d-matrix/
│ │ │ ├── search-a-2d-matrix.js
│ │ │ └── search-a-2d-matrix.py
│ │ ├── search-a-2d-matrix-ii/
│ │ │ └── search-a-2d-matrix-ii.py
│ │ ├── set-matrix-zeroes/
│ │ │ └── set-matrix-zeroes.js
│ │ ├── sort-the-students-by-their-kth-score/
│ │ │ └── sort-the-students-by-their-kth-score.js
│ │ ├── sort_the_matrix_diagonally/
│ │ │ └── sort_the_matrix_diagonally.py
│ │ ├── string-compression/
│ │ │ ├── string-compression-copy.js
│ │ │ └── string-compression.js
│ │ ├── subrectangle_queries/
│ │ │ └── subrectangle_queries.py
│ │ ├── sum_of_nodes/
│ │ │ └── sum_of_nodes.py
│ │ ├── two-sum-ii-input-array-is-sorted/
│ │ │ ├── two-sum-ii-input-array-is-sorted-2.js
│ │ │ └── two-sum-ii-input-array-is-sorted.js
│ │ ├── valid-sudoku/
│ │ │ └── valid-sudoku.js
│ │ ├── validate-binary-search-tree/
│ │ │ ├── validate-binary-search-tree-2.js
│ │ │ ├── validate-binary-search-tree-almost-right.js
│ │ │ └── validate-binary-search-tree.js
│ │ └── watering-plants/
│ │ ├── tests/
│ │ │ └── watering-plants.test.js
│ │ └── watering-plants.js
│ ├── python/
│ │ └── string.py
│ └── top-problems/
│ ├── are-anagrams.js
│ ├── first-and-last-index.js
│ ├── kth-largest.js
│ ├── min-sliding-window.js
│ └── tests/
│ ├── are-anagrams.test.js
│ ├── first-and-last-index.test.js
│ └── kth-largest.test.js
├── college/
│ ├── graph/
│ │ └── atoms.py
│ └── web/
│ ├── css/
│ │ ├── estilos.css
│ │ └── index.html
│ ├── index.html
│ ├── js.js
│ └── loop.js
├── competitive-programming/
│ ├── 4clojure/
│ │ ├── problem01.clj
│ │ ├── problem02.clj
│ │ ├── problem03.clj
│ │ ├── problem04.clj
│ │ ├── problem05.clj
│ │ ├── problem06.clj
│ │ ├── problem07.clj
│ │ ├── problem19.clj
│ │ └── problem20.clj
│ ├── acm-icpc-br/
│ │ ├── regionals_2011/
│ │ │ ├── armstrong.cpp
│ │ │ ├── calculadora.cpp
│ │ │ ├── cartoes.cpp
│ │ │ ├── concurso.cpp
│ │ │ ├── coral.cpp
│ │ │ ├── elevador.cpp
│ │ │ ├── estacionamento.cpp
│ │ │ ├── extenso.cpp
│ │ │ ├── goldbach.cpp
│ │ │ ├── matriz_esparsa.cpp
│ │ │ ├── pascal.cpp
│ │ │ ├── polinomio.cpp
│ │ │ ├── quadrado.cpp
│ │ │ └── vagas.cpp
│ │ ├── regionals_2017_1/
│ │ │ └── A.cpp
│ │ └── regionals_2017_2/
│ │ ├── D.cpp
│ │ ├── F.cpp
│ │ ├── J.py
│ │ └── M.cpp
│ ├── codeforces/
│ │ └── div2/
│ │ ├── black_square.cpp
│ │ ├── karen_and_morning.cpp
│ │ ├── keyboard_layouts.cpp
│ │ ├── the_child_and_the_homework.cpp
│ │ ├── the_child_and_toy.cpp
│ │ └── valera_and_plates.cpp
│ ├── exercism/
│ │ ├── clojure/
│ │ │ ├── armstrong-numbers/
│ │ │ │ ├── .exercism/
│ │ │ │ │ └── metadata.json
│ │ │ │ ├── .lein-failures
│ │ │ │ ├── .lein-repl-history
│ │ │ │ ├── README.md
│ │ │ │ ├── project.clj
│ │ │ │ ├── src/
│ │ │ │ │ └── armstrong_numbers.clj
│ │ │ │ ├── target/
│ │ │ │ │ ├── classes/
│ │ │ │ │ │ └── META-INF/
│ │ │ │ │ │ └── maven/
│ │ │ │ │ │ └── armstrong-numbers/
│ │ │ │ │ │ └── armstrong-numbers/
│ │ │ │ │ │ └── pom.properties
│ │ │ │ │ └── stale/
│ │ │ │ │ └── leiningen.core.classpath.extract-native-dependencies
│ │ │ │ └── test/
│ │ │ │ └── armstrong_numbers_test.clj
│ │ │ ├── hello-world/
│ │ │ │ ├── README.md
│ │ │ │ ├── project.clj
│ │ │ │ ├── src/
│ │ │ │ │ └── hello-world.clj
│ │ │ │ └── test/
│ │ │ │ └── hello-world-test.clj
│ │ │ └── two-fer/
│ │ │ ├── .exercism/
│ │ │ │ └── metadata.json
│ │ │ ├── .lein-failures
│ │ │ ├── .nrepl-port
│ │ │ ├── README.md
│ │ │ ├── project.clj
│ │ │ ├── src/
│ │ │ │ └── two_fer.clj
│ │ │ ├── target/
│ │ │ │ ├── classes/
│ │ │ │ │ └── META-INF/
│ │ │ │ │ └── maven/
│ │ │ │ │ └── two-fer/
│ │ │ │ │ └── two-fer/
│ │ │ │ │ └── pom.properties
│ │ │ │ ├── repl-port
│ │ │ │ └── stale/
│ │ │ │ └── leiningen.core.classpath.extract-native-dependencies
│ │ │ └── test/
│ │ │ └── two_fer_test.clj
│ │ └── javascript/
│ │ ├── allergies.js
│ │ ├── collatz-conjecture.js
│ │ ├── count-words.js
│ │ ├── etl.js
│ │ ├── flatten-array.js
│ │ ├── gigasecond.js
│ │ ├── hello-world.js
│ │ ├── leap.js
│ │ ├── perfect-numbers.js
│ │ ├── phone-number.js
│ │ ├── resistor-color.js
│ │ ├── resistor-colors.js
│ │ ├── reverse-string.js
│ │ ├── sublist.js
│ │ ├── sum-of-multiples.js
│ │ ├── triangle.js
│ │ └── two-fer.js
│ ├── hacker-rank/
│ │ ├── algorithms/
│ │ │ ├── strings/
│ │ │ │ └── palindrome_index.py
│ │ │ └── warmup/
│ │ │ ├── birthday_cake_candles.py
│ │ │ └── mini_max_sum.py
│ │ ├── cpp/
│ │ │ └── introduction/
│ │ │ ├── angry_professor.cpp
│ │ │ ├── arrays_introduction.cpp
│ │ │ ├── diagonal_difference.cpp
│ │ │ ├── input_and_output.cpp
│ │ │ ├── library_fine.cpp
│ │ │ ├── plus_minus.cpp
│ │ │ ├── staircase.cpp
│ │ │ ├── time_conversion.cpp
│ │ │ ├── vector_erase.cpp
│ │ │ └── vector_sort.cpp
│ │ ├── data_structures/
│ │ │ └── trees/
│ │ │ ├── in_order_traversal.py
│ │ │ ├── post_order_traversal.py
│ │ │ └── pre_order_traversal.py
│ │ ├── functional-programming/
│ │ │ ├── array_of_n_elements/
│ │ │ │ ├── array_of_n_elements.clj
│ │ │ │ └── array_of_n_elements_without_range.clj
│ │ │ ├── basics/
│ │ │ │ ├── hello_world.clj
│ │ │ │ ├── hello_world_n_times.clj
│ │ │ │ └── solve_me_first.clj
│ │ │ ├── eval_ex/
│ │ │ │ └── main.clj
│ │ │ ├── filter_array/
│ │ │ │ └── filter_array.clj
│ │ │ ├── filter_positions_in_a_list/
│ │ │ │ └── filter_positions_in_a_list.clj
│ │ │ ├── list_length/
│ │ │ │ ├── list_length.clj
│ │ │ │ └── list_length_reduce.clj
│ │ │ ├── list_replication/
│ │ │ │ └── list_replication.clj
│ │ │ ├── reverse_a_list/
│ │ │ │ ├── reverse_a_list.clj
│ │ │ │ ├── reverse_a_list_into.clj
│ │ │ │ └── reverse_a_list_reduce.clj
│ │ │ ├── sum_of_odd_elements/
│ │ │ │ └── sum_of_odd_elements.clj
│ │ │ └── update_list/
│ │ │ ├── update_list.clj
│ │ │ ├── update_list_anonymous.clj
│ │ │ ├── update_list_map.clj
│ │ │ └── update_list_map_anonymous.clj
│ │ └── python/
│ │ ├── basic_data_types/
│ │ │ ├── finding_the_percentage.py
│ │ │ ├── lists.py
│ │ │ ├── nested_list.py
│ │ │ ├── runner_up_score.py
│ │ │ └── tuple.py
│ │ ├── introduction/
│ │ │ ├── arithmetic_operators.py
│ │ │ ├── division.py
│ │ │ └── if_else.py
│ │ ├── sets/
│ │ │ └── intro_to_sets.py
│ │ └── strings/
│ │ ├── find_a_string.py
│ │ ├── mutate_string.py
│ │ ├── split_and_join.py
│ │ ├── string_validators.py
│ │ ├── swap_case.py
│ │ ├── text_wrap.py
│ │ └── whats_your_name.py
│ ├── interfatecs/
│ │ ├── 1_2016/
│ │ │ ├── a.cpp
│ │ │ ├── b.cpp
│ │ │ ├── g.cpp
│ │ │ └── i.cpp
│ │ └── 1_2018/
│ │ ├── a.cpp
│ │ ├── b.cpp
│ │ ├── c.cpp
│ │ ├── d.py
│ │ ├── e.py
│ │ ├── f.py
│ │ ├── g.cpp
│ │ ├── h.cpp
│ │ ├── i.py
│ │ └── j.cpp
│ ├── spoj-br/
│ │ ├── aero.cpp
│ │ ├── bafo.cpp
│ │ ├── bapostas.cpp
│ │ ├── bit.cpp
│ │ ├── calcula.cpp
│ │ ├── calculadora.cpp
│ │ ├── dentista.cpp
│ │ ├── desculpa.cpp
│ │ ├── eleicoes1.cpp
│ │ ├── eleicoes2.cpp
│ │ ├── estagio.cpp
│ │ ├── fatorial.cpp
│ │ ├── feyman.cpp
│ │ ├── fliperam.cpp
│ │ ├── gangorra.cpp
│ │ ├── guardacosta.cpp
│ │ ├── impedido.cpp
│ │ ├── letra.cpp
│ │ ├── loopmusi.cpp
│ │ ├── lua.cpp
│ │ ├── macaco.cpp
│ │ ├── minhoca.cpp
│ │ ├── miojo.cpp
│ │ ├── obi.cpp
│ │ ├── obihanoi.cpp
│ │ ├── parprox.cpp
│ │ ├── peca.cpp
│ │ ├── primo.cpp
│ │ ├── rumo9s.cpp
│ │ ├── saldo.cpp
│ │ ├── saldo13.cpp
│ │ ├── sorvete.cpp
│ │ ├── sudoku.cpp
│ │ ├── telefone.cpp
│ │ ├── transporte.cpp
│ │ ├── troco13.cpp
│ │ ├── vivo.cpp
│ │ └── wcw.cpp
│ ├── timus/
│ │ └── a+b_problem.cpp
│ ├── ucoder/
│ │ ├── armstrong_numbers.cpp
│ │ ├── historico_de_comandos.cpp
│ │ ├── imperador_cassius.cpp
│ │ ├── matriz_esparsa.cpp
│ │ ├── obi.cpp
│ │ └── tsetse.cpp
│ ├── uri/
│ │ ├── 3d_virtual_museum.cpp
│ │ ├── a_long_time_ago.cpp
│ │ ├── above_average.cpp
│ │ ├── above_secundary_diagonal.cpp
│ │ ├── above_the_main_diagonal.cpp
│ │ ├── abracadabra.cpp
│ │ ├── advancing_letters.cpp
│ │ ├── age_in_day.cpp
│ │ ├── ages.cpp
│ │ ├── alarm_clock.cpp
│ │ ├── alliteration.cpp
│ │ ├── andys_first_dictionary.cpp
│ │ ├── angry_ducks.cpp
│ │ ├── animal.cpp
│ │ ├── approximate_number_of_primes.cpp
│ │ ├── area.cpp
│ │ ├── area_of_circle.cpp
│ │ ├── arranging_tasks.cpp
│ │ ├── array_123.cpp
│ │ ├── array_change_1.cpp
│ │ ├── array_fill_1.cpp
│ │ ├── array_fill_2.cpp
│ │ ├── array_fill_3.cpp
│ │ ├── array_fill_4.cpp
│ │ ├── array_hash.cpp
│ │ ├── array_replacement_1.cpp
│ │ ├── array_selection_1.cpp
│ │ ├── as_abas_de_pericles.cpp
│ │ ├── ascending_and_descending.cpp
│ │ ├── assigning_teams.cpp
│ │ ├── automated_checking_machine.cpp
│ │ ├── average_1.cpp
│ │ ├── average_2.cpp
│ │ ├── average_3.cpp
│ │ ├── average_speed.cpp
│ │ ├── back_to_high_school_physics.cpp
│ │ ├── bacteria_1.cpp
│ │ ├── banknotes.cpp
│ │ ├── banknotes_and_coins.cpp
│ │ ├── baskharas_formula.cpp
│ │ ├── batmain.cpp
│ │ ├── bazinga.cpp
│ │ ├── below_the_main_diagonal.cpp
│ │ ├── below_the_secundary_diagonal.cpp
│ │ ├── bill.cpp
│ │ ├── bingo.cpp
│ │ ├── bla.cpp
│ │ ├── blobs.cpp
│ │ ├── bloggo_shotcuts.cpp
│ │ ├── bob_conduit.cpp
│ │ ├── bodybuilder.cpp
│ │ ├── brazil_world_cup.cpp
│ │ ├── brazilian_economy.cpp
│ │ ├── brick_game.cpp
│ │ ├── bubbles_and_bucket.cpp
│ │ ├── bubbles_and_bucket_2.cpp
│ │ ├── building_houses.cpp
│ │ ├── building_walls.cpp
│ │ ├── buttlerflies.cpp
│ │ ├── c_mais_ou_menos.cpp
│ │ ├── caeser_cipher.cpp
│ │ ├── cannon.cpp
│ │ ├── canteen_queue.cpp
│ │ ├── cash_roial.cpp
│ │ ├── chinese_whispers.cpp
│ │ ├── chirrin_chirrion.cpp
│ │ ├── chocolate_factory.cpp
│ │ ├── christmas_decoration.cpp
│ │ ├── christmas_olympic.cpp
│ │ ├── christmas_trapeziums.cpp
│ │ ├── christmas_tree.cpp
│ │ ├── close_the_doors.cpp
│ │ ├── coast_guard.cpp
│ │ ├── coffee_machine.cpp
│ │ ├── colision.cpp
│ │ ├── collectable_cards.cpp
│ │ ├── colourful_flowers.cpp
│ │ ├── column_in_array.cpp
│ │ ├── combiner.cpp
│ │ ├── compare_substring.cpp
│ │ ├── complete_sequence.cpp
│ │ ├── consumption.cpp
│ │ ├── contando_ciclos.cpp
│ │ ├── contest.cpp
│ │ ├── contract_revision.cpp
│ │ ├── converting_to_hexadecimal.cpp
│ │ ├── coordinates_of_a_point.cpp
│ │ ├── correct_colourful_flower.cpp
│ │ ├── corrida.cpp
│ │ ├── counting_crow.cpp
│ │ ├── counting_sheeps.cpp
│ │ ├── cutoff_rounder.cpp
│ │ ├── cutoff_rounder_2.cpp
│ │ ├── dancing_sentence.cpp
│ │ ├── dangerous_dive.cpp
│ │ ├── dating_online.cpp
│ │ ├── deciphering_the_encrypted_card.cpp
│ │ ├── delaunay_triangulation.cpp
│ │ ├── desafio_de_bino.cpp
│ │ ├── detective_watson_1.cpp
│ │ ├── detective_watson_2.cpp
│ │ ├── diamonds_and_sand.cpp
│ │ ├── diet_plan.cpp
│ │ ├── difference.cpp
│ │ ├── different_digits.cpp
│ │ ├── difn.cpp
│ │ ├── dijkstra.cpp
│ │ ├── discovering_password.cpp
│ │ ├── distance.cpp
│ │ ├── distance_between_two_points.cpp
│ │ ├── dividers.cpp
│ │ ├── dividing_x_by_y.cpp
│ │ ├── diving.cpp
│ │ ├── division_of_nlogonia.cpp
│ │ ├── divisors_1.cpp
│ │ ├── dracarys.cpp
│ │ ├── drought.cpp
│ │ ├── easy_difference_dates.cpp
│ │ ├── easy_fibonacci.cpp
│ │ ├── easy_problem_from_rujia_liu_1.cpp
│ │ ├── easy_problem_from_rujia_liu_2.cpp
│ │ ├── eletrical_outlet.cpp
│ │ ├── encryption.cpp
│ │ ├── engine_failure.cpp
│ │ ├── erasing_and_winning.cpp
│ │ ├── estimating_the_mean.cpp
│ │ ├── etiquetas_de_noel.cpp
│ │ ├── even_and_odd.cpp
│ │ ├── even_between_five_numbers.cpp
│ │ ├── even_numbers.cpp
│ │ ├── even_or_odd.cpp
│ │ ├── even_square.cpp
│ │ ├── event.cpp
│ │ ├── event_time.cpp
│ │ ├── exceeding_z.cpp
│ │ ├── exchanging_cards.cpp
│ │ ├── experiments.cpp
│ │ ├── extremely_basic.cpp
│ │ ├── face_2015_free_gift.cpp
│ │ ├── factorial.cpp
│ │ ├── factorial_again.cpp
│ │ ├── factorial_sum.cpp
│ │ ├── fake_tickets.cpp
│ │ ├── fans_and_ballons.cpp
│ │ ├── farm_robot.cpp
│ │ ├── fase.cpp
│ │ ├── fast_fibonacci.cpp
│ │ ├── fast_prime_number.cpp
│ │ ├── feedback.cpp
│ │ ├── feyman.cpp
│ │ ├── fibonacci_again.cpp
│ │ ├── fibonacci_array.cpp
│ │ ├── fila_do_supermercado.cpp
│ │ ├── fire_flowers.cpp
│ │ ├── fit_or_dont_fit_1.cpp
│ │ ├── fit_or_dont_fit_2.cpp
│ │ ├── fixed_password.cpp
│ │ ├── flavious_josephus_legend.cpp
│ │ ├── flavious_josephus_legend2.cpp
│ │ ├── flavious_josephus_legend3.cpp
│ │ ├── flowers_flourish_from_france.cpp
│ │ ├── football.cpp
│ │ ├── frequent_asked_questions.cpp
│ │ ├── friends_of_habey.cpp
│ │ ├── fuel_spent.cpp
│ │ ├── functions.cpp
│ │ ├── galopeira.cpp
│ │ ├── game_of_the_greatness.cpp
│ │ ├── general_exam.cpp
│ │ ├── getline_fruits.cpp
│ │ ├── getline_one.cpp
│ │ ├── getline_three_shoes.cpp
│ │ ├── going_to_the_market.cpp
│ │ ├── grains_in_a_chess_board.cpp
│ │ ├── grenais.cpp
│ │ ├── growing_sequences.cpp
│ │ ├── guess_what.cpp
│ │ ├── guilherme_and_his_kites.cpp
│ │ ├── guru_da_sorte.cpp
│ │ ├── hailstone_sequences.cpp
│ │ ├── hall_of_murderers.cpp
│ │ ├── hall_of_murderers_2.cpp
│ │ ├── hall_of_murderers_3.cpp
│ │ ├── hamekameka.cpp
│ │ ├── handball.cpp
│ │ ├── hardwood_species.cpp
│ │ ├── hash_tables.cpp
│ │ ├── hashmat_the_brave_warrior.cpp
│ │ ├── hay_points.cpp
│ │ ├── he_is_offside!.cpp
│ │ ├── head_or_tails.cpp
│ │ ├── height.cpp
│ │ ├── hello_galaxy.cpp
│ │ ├── help!.cpp
│ │ ├── help_girafales.cpp
│ │ ├── help_seu_madruga.cpp
│ │ ├── help_seu_madruga_int.cpp
│ │ ├── help_the_federation.cpp
│ │ ├── hexagonal_tiles_1.cpp
│ │ ├── hexagonal_tiles_2.cpp
│ │ ├── hidden_message.cpp
│ │ ├── highest_and_position.cpp
│ │ ├── hohoho.cpp
│ │ ├── honey_reservoir.cpp
│ │ ├── hours_and_minutes.cpp
│ │ ├── how_easy.cpp
│ │ ├── huehue.cpp
│ │ ├── i_am_toorg.cpp
│ │ ├── ice_statuses.cpp
│ │ ├── identifying_tea.cpp
│ │ ├── image.cpp
│ │ ├── impar_par_roubo.cpp
│ │ ├── inferior_area.cpp
│ │ ├── inside_out.cpp
│ │ ├── international_chat.cpp
│ │ ├── internship.cpp
│ │ ├── interval.cpp
│ │ ├── interval2.cpp
│ │ ├── inverse_numbers.cpp
│ │ ├── is_triangle.cpp
│ │ ├── jetiqui.cpp
│ │ ├── jingle_composing.cpp
│ │ ├── jogatina_ufpa.cpp
│ │ ├── jogo_da_boca.py
│ │ ├── jollo.cpp
│ │ ├── joulupukki.cpp
│ │ ├── jumping_frog.cpp
│ │ ├── just_in_time.cpp
│ │ ├── justifier.cpp
│ │ ├── justifier_2.cpp
│ │ ├── kage_bunshin_no_jutsu.cpp
│ │ ├── kiloman.cpp
│ │ ├── koch_snowflake.cpp
│ │ ├── lap.cpp
│ │ ├── laser_sculpture.cpp
│ │ ├── last_analogimon.cpp
│ │ ├── laundry.cpp
│ │ ├── leaders_impeachment.cpp
│ │ ├── led.cpp
│ │ ├── left_area.cpp
│ │ ├── libertadores_1.cpp
│ │ ├── libertadores_2.cpp
│ │ ├── line_in_array.cpp
│ │ ├── linear_parking_lot.cpp
│ │ ├── little_ant.cpp
│ │ ├── little_ducks.py
│ │ ├── logical_sequence.cpp
│ │ ├── logical_sequence_2.cpp
│ │ ├── lost_boots.cpp
│ │ ├── lowest_number_and_position.cpp
│ │ ├── lu_di_oh.cpp
│ │ ├── lucro.cpp
│ │ ├── lucro_otimizado.cpp
│ │ ├── macpronalts.cpp
│ │ ├── maesters_map.cpp
│ │ ├── mean_median_problem.cpp
│ │ ├── medal_table.cpp
│ │ ├── merry_christmaaaas.cpp
│ │ ├── mirror_sequence.cpp
│ │ ├── mjolnir.cpp
│ │ ├── monetary_formatting.cpp
│ │ ├── montanha_russa.cpp
│ │ ├── month.cpp
│ │ ├── moon_phases.cpp
│ │ ├── morse.cpp
│ │ ├── motoboy.cpp
│ │ ├── multiple_of_13.cpp
│ │ ├── multiple_reading.cpp
│ │ ├── multiples.cpp
│ │ ├── multiplication_table.cpp
│ │ ├── musical_loop.cpp
│ │ ├── name_at_form.cpp
│ │ ├── natural_sum.cpp
│ │ ├── new_record.cpp
│ │ ├── nine.cpp
│ │ ├── number_frequence.cpp
│ │ ├── obi_uri.cpp
│ │ ├── odd_numbers.cpp
│ │ ├── og.cpp
│ │ ├── one_two_three.cpp
│ │ ├── operator_game.cpp
│ │ ├── optical_reader.cpp
│ │ ├── our_days_are_never_coming_back.cpp
│ │ ├── painel_led.cpp
│ │ ├── palindrome_game.cpp
│ │ ├── pandorgas.cpp
│ │ ├── pao_de_queijo_sweeper.cpp
│ │ ├── parafusos_e_porcas.cpp
│ │ ├── parenthesis_balance.cpp
│ │ ├── parity.cpp
│ │ ├── pascal_library.cpp
│ │ ├── password.cpp
│ │ ├── password_validator.cpp
│ │ ├── paulas_mathematic_game.cpp
│ │ ├── peaks_and_valleys.cpp
│ │ ├── pedrinhos_christmas.cpp
│ │ ├── pepe.cpp
│ │ ├── perfect_number.cpp
│ │ ├── phin_bonati.cpp
│ │ ├── pizza_pre_bh.cpp
│ │ ├── pokemon.cpp
│ │ ├── pomekon_collection.cpp
│ │ ├── pomekons_battle.cpp
│ │ ├── population_increase.cpp
│ │ ├── positive_numbers.cpp
│ │ ├── positives_and_average.cpp
│ │ ├── power_crisis.cpp
│ │ ├── preface.cpp
│ │ ├── presents.cpp
│ │ ├── primary_arithmatic.cpp
│ │ ├── prime_number.cpp
│ │ ├── pum.cpp
│ │ ├── quadrant.cpp
│ │ ├── queen.cpp
│ │ ├── radares.cpp
│ │ ├── rails.cpp
│ │ ├── rails_again.cpp
│ │ ├── reading_books.cpp
│ │ ├── regular_simple_polygon.cpp
│ │ ├── remaining2.cpp
│ │ ├── removing_letter.cpp
│ │ ├── rest_of_a_division.cpp
│ │ ├── right_area.cpp
│ │ ├── rlj.cpp
│ │ ├── robot_instructions.cpp
│ │ ├── rock_paper_airstrike.cpp
│ │ ├── rock_paper_scissors_lizard_spock.cpp
│ │ ├── roman_numerals_for_page_numbers.cpp
│ │ ├── rot13.cpp
│ │ ├── s_sequence.cpp
│ │ ├── s_sequence_2.cpp
│ │ ├── salary.cpp
│ │ ├── salary_with_bonus.cpp
│ │ ├── santas_translator.cpp
│ │ ├── scientific_notation.cpp
│ │ ├── score_validation.cpp
│ │ ├── searching_for_nessy.cpp
│ │ ├── searching_subsequences.cpp
│ │ ├── selection_test_1.cpp
│ │ ├── sequence_ij_1.cpp
│ │ ├── sequence_ij_2.cpp
│ │ ├── sequence_ij_3.cpp
│ │ ├── sequence_ij_4.cpp
│ │ ├── sequence_of_numbers_and_sum.cpp
│ │ ├── sequence_of_sequence.cpp
│ │ ├── seven.cpp
│ │ ├── several_scores_with_validation.cpp
│ │ ├── short_attendance.cpp
│ │ ├── short_story.cpp
│ │ ├── simple_calculate.cpp
│ │ ├── simple_factorial.cpp
│ │ ├── simple_prod.cpp
│ │ ├── simple_sort.cpp
│ │ ├── simple_sum.cpp
│ │ ├── simulator.cpp
│ │ ├── six_odd_numbers.cpp
│ │ ├── snack.cpp
│ │ ├── sort_by_length.cpp
│ │ ├── sort_sort_and_sort.cpp
│ │ ├── sphere.cpp
│ │ ├── spurs_rock.cpp
│ │ ├── square_array_4.cpp
│ │ ├── square_game.cpp
│ │ ├── square_matrix_1.cpp
│ │ ├── square_matrix_2.cpp
│ │ ├── square_matrix_3.cpp
│ │ ├── square_root_of_10.cpp
│ │ ├── square_root_of_2.cpp
│ │ ├── square_spiral.cpp
│ │ ├── squared_and_cubic.cpp
│ │ ├── ssn_1.cpp
│ │ ├── star_trek.cpp
│ │ ├── start_grid.cpp
│ │ ├── stick_collector_robot.cpp
│ │ ├── sticks_game.cpp
│ │ ├── strategy_game.cpp
│ │ ├── subprime.cpp
│ │ ├── sucessor_par.cpp
│ │ ├── sudoku.cpp
│ │ ├── sum_of_consecutive_even_numbers.cpp
│ │ ├── sum_of_consecutive_odd_numbers_3.cpp
│ │ ├── sum_of_consecutive_odd_numbers_I.cpp
│ │ ├── sum_of_consecutive_odd_numbers_II.cpp
│ │ ├── sum_of_two_squares.cpp
│ │ ├── summer_camp.cpp
│ │ ├── summing_consecutive_integers.cpp
│ │ ├── sunday_morning.cpp
│ │ ├── superior_area.cpp
│ │ ├── system_of_download.cpp
│ │ ├── taxes_of_project.cpp
│ │ ├── tda_rational_1.cpp
│ │ ├── tda_rational_2.cpp
│ │ ├── tell_me_the_frequencies.cpp
│ │ ├── the_chosen.cpp
│ │ ├── the_force_awakens.cpp
│ │ ├── the_greater_one_digit_number.cpp
│ │ ├── the_greatest.cpp
│ │ ├── the_library_of_mr_severino.cpp
│ │ ├── the_motion_picture.cpp
│ │ ├── the_pythagorean_theorem.cpp
│ │ ├── the_race_of_slugs.cpp
│ │ ├── the_return_of_radar.cpp
│ │ ├── the_return_of_the_king.cpp
│ │ ├── the_square_game.cpp
│ │ ├── the_wrath_of_khan.cpp
│ │ ├── theons_answer.cpp
│ │ ├── threebonacci_sequence.cpp
│ │ ├── throwing_cards_away.cpp
│ │ ├── time_conversion.cpp
│ │ ├── time_zone.cpp
│ │ ├── to_care_or_not_to_care.cpp
│ │ ├── to_care_or_not_to_care2.cpp
│ │ ├── top_n.cpp
│ │ ├── tornado.cpp
│ │ ├── train_swaping.cpp
│ │ ├── tri-du.cpp
│ │ ├── triangle.cpp
│ │ ├── triangle_types.cpp
│ │ ├── triangles.cpp
│ │ ├── tribol.cpp
│ │ ├── trinomial_triangle.cpp
│ │ ├── tshirt2.cpp
│ │ ├── tshirts.cpp
│ │ ├── tug_of_war.cpp
│ │ ├── turma_jb6.cpp
│ │ ├── turn_left.cpp
│ │ ├── turn_left2.cpp
│ │ ├── tustin_and_his_new_die.cpp
│ │ ├── twilight_at_portland.cpp
│ │ ├── twitting.cpp
│ │ ├── two_bills.cpp
│ │ ├── type_of_fuel.cpp
│ │ ├── upset_fracil.cpp
│ │ ├── uri.cpp
│ │ ├── vai_na_sort.cpp
│ │ ├── variations.cpp
│ │ ├── virus.cpp
│ │ ├── vitoria_and_her_indecision.cpp
│ │ ├── volleyball.cpp
│ │ ├── weighted_averages.cpp
│ │ ├── welcome_to_the_winter.cpp
│ │ ├── wertyu.cpp
│ │ ├── where_is_the_marble.cpp
│ │ ├── which_triangle.cpp
│ │ ├── who_turn_is_it.cpp
│ │ ├── wills_message.cpp
│ │ ├── world_cup.cpp
│ │ ├── zero_means_zero.cpp
│ │ └── zero_or_one.cpp
│ ├── uva/
│ │ └── 280-vertex.cpp
│ └── weekend-code-challenge/
│ ├── 01-object-to-array-of-objects/
│ │ ├── README.md
│ │ └── soluition1.js
│ ├── 02-my-likes/
│ │ ├── README.md
│ │ ├── solution1.js
│ │ └── solution2.js
│ ├── 03-ch-ch-ch-changes/
│ │ ├── README.md
│ │ └── solution.js
│ ├── 07-zero-to-hero/
│ │ ├── README.md
│ │ └── solution1.js
│ ├── 08-first-non-repeat/
│ │ ├── README.md
│ │ └── solution1.js
│ ├── 09-big-three/
│ │ ├── README.md
│ │ ├── solution1.js
│ │ └── solution2.js
│ ├── 10-get-the-photo/
│ │ ├── README.md
│ │ └── solution1.js
│ └── 11-threes-a-crowd/
│ ├── README.md
│ └── solution1.js
├── computer_science/
│ ├── README.md
│ ├── algorithms/
│ │ ├── binary-search/
│ │ │ ├── binary-search.js
│ │ │ └── tests/
│ │ │ └── binary-search.test.js
│ │ ├── bubble-sort/
│ │ │ ├── bubble-sort.js
│ │ │ └── tests/
│ │ │ └── bubble-sort.test.js
│ │ ├── dynamic_programming/
│ │ │ ├── factorial.cpp
│ │ │ └── fibonacci.cpp
│ │ ├── find_kth_element/
│ │ │ └── find_kth_element_1.cpp
│ │ ├── graphs/
│ │ │ ├── bfs.cpp
│ │ │ └── dfs.cpp
│ │ ├── is-prime/
│ │ │ └── is-prime.js
│ │ ├── kadane/
│ │ │ └── kadane.js
│ │ ├── knapsack/
│ │ │ ├── knapsack1.cpp
│ │ │ └── knapsack2.cpp
│ │ ├── least_common_multiple/
│ │ │ └── least_common_multiple.cpp
│ │ ├── linear-search/
│ │ │ ├── linear-search.js
│ │ │ └── tests/
│ │ │ └── linear-search.test.js
│ │ ├── maximum_subsequence_sum/
│ │ │ ├── maximum_subsequence_sum_1.cpp
│ │ │ └── maximum_subsequence_sum_2.cpp
│ │ ├── min_and_max/
│ │ │ └── minimax.cpp
│ │ ├── parse_strings/
│ │ │ └── parse_strings.cpp
│ │ ├── pointers/
│ │ │ └── pointer.cpp
│ │ ├── prime_number/
│ │ │ └── prime_number.cpp
│ │ ├── recursion/
│ │ │ ├── fibonacci/
│ │ │ │ ├── fibonacci.c
│ │ │ │ └── fibonacci.py
│ │ │ ├── log_2.c
│ │ │ ├── palindromo.c
│ │ │ ├── regua.c
│ │ │ ├── reverse.c
│ │ │ └── sum.py
│ │ ├── reverse-string/
│ │ │ ├── reverse-string-in-place.js
│ │ │ ├── reverse-string.js
│ │ │ └── tests/
│ │ │ └── reverse-string.test.js
│ │ ├── search/
│ │ │ ├── binary_search.cpp
│ │ │ ├── binary_search.py
│ │ │ ├── recursive_binary_search.py
│ │ │ └── sequential_search.py
│ │ ├── segment-tree/
│ │ │ └── sum/
│ │ │ └── lazy_update.cpp
│ │ ├── sorting/
│ │ │ ├── bubble_sort/
│ │ │ │ ├── bubble_sort.cpp
│ │ │ │ ├── bubble_sort.py
│ │ │ │ └── test_bubble_sort.py
│ │ │ ├── insertion_sort.cpp
│ │ │ ├── merge_sort.cpp
│ │ │ ├── reverse_insertion_sort.cpp
│ │ │ ├── selection_sort.cpp
│ │ │ └── string_insertion_sort.cpp
│ │ ├── string_to_int/
│ │ │ └── string_to_int.cpp
│ │ └── subset/
│ │ └── subset.js
│ ├── big_o/
│ │ ├── README.md
│ │ ├── example1.py
│ │ ├── example10.py
│ │ ├── example11.py
│ │ ├── example12.py
│ │ ├── example13.py
│ │ ├── example14.py
│ │ ├── example15.py
│ │ ├── example16.py
│ │ ├── example17.py
│ │ ├── example18.py
│ │ ├── example19.py
│ │ ├── example2.py
│ │ ├── example20.py
│ │ ├── example21.py
│ │ ├── example22.py
│ │ ├── example3.py
│ │ ├── example4.py
│ │ ├── example5.py
│ │ ├── example6.py
│ │ ├── example7.py
│ │ └── example9.py
│ └── data_structures/
│ ├── array/
│ │ ├── array.cpp
│ │ ├── big_o.py
│ │ ├── list.py
│ │ └── vectors.cpp
│ ├── binary-heap/
│ │ ├── README.md
│ │ ├── min-heap.js
│ │ └── min-heap.test.js
│ ├── binary_search_tree/
│ │ ├── BinarySearchTree/
│ │ │ ├── index.js
│ │ │ └── index.test.js
│ │ ├── big_o.py
│ │ ├── binary_search_tree.py
│ │ ├── test_binary_search_tree.py
│ │ └── test_node.py
│ ├── binary_search_tree_without_node/
│ │ ├── binary_search_tree.py
│ │ └── test_binary_search_tree.py
│ ├── binary_tree/
│ │ ├── BinaryTree/
│ │ │ ├── index.js
│ │ │ └── index.test.js
│ │ ├── big_o.py
│ │ ├── binary_tree.py
│ │ └── test_binary_tree.py
│ ├── graph/
│ │ ├── AdjacentListGraph/
│ │ │ ├── AdjacentListGraph.js
│ │ │ └── example.js
│ │ ├── README.md
│ │ ├── adjacency_list.cpp
│ │ ├── graph.js
│ │ ├── graph.py
│ │ └── test_graph.py
│ ├── hash_table/
│ │ ├── big_o.py
│ │ ├── dictionary.py
│ │ └── maps.cpp
│ ├── linked_list/
│ │ ├── big-o.js
│ │ ├── big_o.py
│ │ ├── linked-list.js
│ │ ├── linked_list.py
│ │ ├── test_linked_list.py
│ │ ├── test_node.py
│ │ └── tests/
│ │ └── linked-list.test.js
│ ├── queue/
│ │ ├── big_o.py
│ │ ├── queue.js
│ │ ├── queue.py
│ │ └── tests/
│ │ └── queue.test.js
│ ├── segment_tree/
│ │ ├── frequency.cpp
│ │ ├── max.cpp
│ │ ├── min.cpp
│ │ └── sum.cpp
│ ├── set/
│ │ ├── set.js
│ │ ├── sets.cpp
│ │ └── tests/
│ │ └── set.test.js
│ ├── stack/
│ │ ├── deque_api.py
│ │ ├── stack.cpp
│ │ ├── stack.js
│ │ ├── stack.py
│ │ ├── stack_class.js
│ │ └── stack_closure.js
│ └── string/
│ └── strings.cpp
├── package.json
├── problem-solving.md
└── system-design.md
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/push-ci.yml
================================================
name: Push CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v2
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Install dependencies
run: yarn
- name: Test
run: yarn test
================================================
FILE: .gitignore
================================================
*.pyc
__pycache__
.pytest_cache
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# typescript
*.tsbuildinfo
.eslintcache
/local
================================================
FILE: .nvmrc
================================================
v20.4.0
================================================
FILE: .prettierrc
================================================
{
"trailingComma": "es5",
"tabWidth": 2,
"singleQuote": true
}
================================================
FILE: .vscode/settings.json
================================================
{
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
================================================
FILE: FUNDING.yml
================================================
github: [imteekay]
custom: [https://teekay.substack.com]
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) TK
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
<samp>
# Algorithms & Data Structures
## Introduction
- [🎥 Algorithms and Data Structures Tutorial](https://www.youtube.com/watch?v=8hly31xKli0&ab_channel=freeCodeCamp.org)
- [🎥 Data Structures and Algorithms in JavaScript](https://www.youtube.com/playlist?list=PLWKjhJtqVAbkso-IbgiiP48n-O-JQA9PJ)
- [🎥 Introduction to Algorithms](https://www.youtube.com/playlist?list=PLUl4u3cNGP63EdVPNLG3ToM6LaEUuStEY)
- [🎥 Python Algorithms for Interviews](https://www.youtube.com/watch?v=p65AHm9MX80)
- [📝 Introduction of Data Structure and algorithm](https://www.scaler.com/topics/data-structures)
- [📝 Top 10 algorithms in interview questions](https://www.geeksforgeeks.org/top-10-algorithms-in-interview-questions)
- [📝 Useful links about algorithms](https://leetcode.com/discuss/general-discussion/665604/important-and-useful-links-from-all-over-the-Leetcode)
- [Leetcode lists](https://docs.google.com/document/d/1lHB0yI7UDcllyCQYqxCHLmFM1F4THDCfrj7_3zC6sDE/edit?tab=t.0)
## Big-O notation and design
- [🎥 Big O Notation w/ Gayle](https://www.youtube.com/watch?v=v4cd1O4zkGw&ab_channel=HackerRank)
- [🎥 Design and Analysis of Algorithms — MIT](https://www.youtube.com/playlist?list=PLUl4u3cNGP6317WaSNfmCvGym2ucw3oGp)
- [💻 Big O](computer_science/big_o)
- [📝 Know your complexities: Big-O cheat sheet](https://www.bigocheatsheet.com)
- [📝 Big O in DS](./big-o.md)
- [📝 Computational complexity part one](https://www.topcoder.com/thrive/articles/Computational%20Complexity%20part%20one)
- [📝 Computational complexity part two](https://www.topcoder.com/thrive/articles/Computational%20Complexity%20part%20two)
## Data Structures
- [🎥 Data Structures Easy to Advanced Course - Full Tutorial from a Google Engineer](https://www.youtube.com/watch?v=RBSGKlAvoiM)
- [💻 Data Structures and Algorithms cheat sheet](https://github.com/TSiege/Tech-Interview-Cheat-Sheet)
- [📝 What is Data Structure?](https://www.scaler.com/topics/data-structures/what-is-data-structure)
### Stack
- [📝 Stack Data Structure in JavaScript](https://www.iamtk.co/series/data-structures-in-javascript/stack-data-structure)
- [📝 Stack Data Structure Practice Problems](https://medium.com/techie-delight/stack-data-structure-practice-problems-and-interview-questions-9f08a35a7f19)
- [📝 Stack Data Structure](https://www.iamtk.co/series/data-structures/stack-data-structure)
### Queues
- [📝 Queue Data Structure in JavaScript](https://www.iamtk.co/series/data-structures-in-javascript/queue-data-structure)
- [📝 Queue Data Structure](https://www.iamtk.co/series/data-structures/queue-data-structure)
- [📝 Queue Data Structure](https://www.scaler.com/topics/data-structures/queue-in-data-structure)
### Linked Lists
- [🎥 Linked Lists for Technical Interviews](https://www.youtube.com/watch?v=Hj_rA0dhr2I&ab_channel=freeCodeCamp.org)
- [📝 Linked Lists Data Structure in JavaScript](https://www.iamtk.co/series/data-structures-in-javascript/linked-list-data-structure)
- [📝 Linked Lists Data Structure](https://www.iamtk.co/series/data-structures/linked-list-data-structure)
- [📝 Linked Lists Data Structure](https://www.scaler.com/topics/linked-list)
### Trees
- [🎥 Binary Tree Algorithms for Technical Interviews](https://www.youtube.com/watch?v=fAAZixBzIAI&ab_channel=freeCodeCamp.org)
- [📝 Tree Data Structure](https://www.iamtk.co/series/data-structures/tree-data-structure)
- [📝 Tree Data Structure](https://www.scaler.com/topics/data-structures/tree-data-structure)
### Graphs
- [🎥 Breadth First Search & Depth First Search](https://www.youtube.com/watch?v=pcKY4hjDrxk&ab_channel=AbdulBari)
- [🎥 Graph Algorithms for Technical Interviews](https://www.youtube.com/watch?v=tWVWeAqZ0WU&ab_channel=freeCodeCamp.org)
- [🎥 Graph data structure — Part 1](https://www.youtube.com/watch?v=JDP1OVgoa0Q&ab_channel=JunminLee)
- [🎥 Graph data structure — Part 2](https://www.youtube.com/watch?v=bSZ57h7GN2w&ab_channel=JunminLee)
- [🎥 Graph Search Algorithms in 100 Seconds](https://www.youtube.com/watch?v=cWNEl4HE2OE&ab_channel=Fireship)
- [📝 Depth First Search](https://www.hackerearth.com/practice/algorithms/graphs/depth-first-search/tutorial)
- [📝 Graph in Data Structure](https://www.scaler.com/topics/data-structures/graph-in-data-structure)
## Algorithms
- [🎥 Problem Patterns](https://designgurus.org/course/grokking-the-coding-interview)
- [🎥 Programação Dinamica](https://www.youtube.com/watch?v=qp9UOJ0XUlg&ab_channel=GubnunBR)
- [📝 3 Tricks To Master Linked List Problems](https://medium.com/interviewnoodle/leetcode-3-tricks-to-master-linked-list-problems-8647a74a5f1c)
- [📝 3 Tricks To Master String Problems](https://medium.com/interviewnoodle/leetcode-3-tricks-to-master-string-problems-bf10079df639)
- [📝 5 Tricks To Solve Any Interval/Conflict Schedule Related Problems](https://medium.com/interviewnoodle/leetcode-5-tricks-to-solve-any-interval-conflict-schedule-related-problems-3f33d6e5af55)
- [📝 Coding Patterns - Backtracking](https://iorilan.medium.com/after-solved-1000-medium-leetcode-found-thes-patterns-backtracking-b683aa8bd8ac)
- [📝 Coding Patterns - BFS](https://iorilan.medium.com/after-finished-1000-leetcode-medium-level-i-found-some-patterns-bfs-63783cbd2c70)
- [📝 Coding Patterns - DFS](https://iorilan.medium.com/after-finished-1000-leetcode-medium-level-i-found-some-patterns-dfs-77e584425474)
- [📝 Coding Patterns - Dynamic Programming](https://iorilan.medium.com/after-solved-1000-leetcode-medium-level-i-found-these-patterns-dynamic-programming-205226223f4e)
- [📝 Coding Patterns - Mono-Stack](https://iorilan.medium.com/after-solved-1000-medium-leetcode-found-thes-patterns-mono-stack-40ce6067abfe)
- [📝 Coding Patterns - Presum, Greedy, intervals](https://iorilan.medium.com/after-solved-1000-medium-leetcode-found-these-patterns-presum-greedy-intervals-511d899bcee3)
- [📝 Coding Patterns - Sliding Window, 2 Pointer, String](https://iorilan.medium.com/after-solved-1000-medium-leetcode-found-these-patterns-sliding-window-2-pointer-string-18332ca4861)
- [📝 Coding Patterns - UnionFind, Devide And Conquer, Toposort](https://iorilan.medium.com/after-solved-1000-medium-leetcode-found-these-patterns-unionfind-devide-and-conquer-toposort-9210dfc90223)
- [📝 Coding Patterns — Binary Search, Trie, Heap](https://medium.com/@iorilan/after-solved-1000-medium-leetcode-found-these-patterns-binary-search-trie-heap-8dc5c82e9e94)
- [📝 Find Kth Largest/Smallest Element Without Sorting](https://medium.com/interviewnoodle/leetcode-find-kth-largest-smallest-element-without-sorting-77b92c75c890)
- [📝 Grokking LeetCode: A Smarter Way to Prepare for Coding Interviews](https://interviewnoodle.com/grokking-leetcode-a-smarter-way-to-prepare-for-coding-interviews-e86d5c9fe4e1)
- [📝 Let's implement a Bloom Filter](https://onatm.dev/2020/08/10/let-s-implement-a-bloom-filter)
- [📝 Master 2D matrix/maze traversal](https://medium.com/interviewnoodle/leetcode-master-2d-matrix-maze-traversal-ec9f2e0bc300)
- [📝 Recursive descent parsing](https://austinhenley.com/blog/teenytinycompiler2.html)
## Coding Interviews
Build the the foundation by learning the fundamental algorithms and data structures:
- Fundamental Algorithms
- [ ] Sorting
- [ ] Merge Sort
- [ ] Quick Sort
- [ ] Bucket Sort
- [ ] Heap Sort
- [ ] Counting Sort
- [x] Searching
- [x] [Binary Search](computer_science/algorithms/binary-search/binary-search.js)
- [x] [Tree Depth First Search](computer_science/data_structures/binary_search_tree)
- [x] [Tree Breadth First Search](computer_science/data_structures/binary_search_tree)
- [ ] Graph Depth First Search
- [ ] Graph Breadth First Search
- [ ] Dynamic Programming
- [x] [String / Array: reverse](computer_science/algorithms/reverse-string/reverse-string.js)
- [x] [Linked list: insertion, deletion](computer_science/data_structures/linked_list)
- Fundamental Data Structures
- [x] [Stack](computer_science/data_structures/stack)
- [x] [Queue](computer_science/data_structures/queue)
- [x] [Linked List](computer_science/data_structures/linked_list)
- [x] [Hash Map](computer_science/data_structures/hash_table)
- [ ] Heap
- [ ] Priority Queue
- [ ] Tree
- [x] [Binary Search Tree](computer_science/data_structures/binary_search_tree)
- [ ] AVL Tree
- [ ] Red-Black Tree
- [ ] Segment Tree
- [ ] Fenwick Tree (Binary Indexed Tree)
- [x] [Graph](computer_science/data_structures/graph)
- Time & Space Complexity
- [ ] Space complexity for all algorithms / data structures
- [ ] Runtime complexity for all algorithms / data structures
- [ ] Make comparisons between algorithms and data structures
### Preparation
- [🎥 10 Common Coding Interview Problems](https://www.youtube.com/watch?v=Peq4GCPNC5c&ab_channel=freeCodeCamp.org)
- [🎥 8 Most Popular Microsoft Coding Interview Questions Solved Step by Step](https://www.youtube.com/watch?v=1P3xh7CGSU8&ab_channel=SCALER)
- [🎥 Crack Your Dream Tech Interviews](https://www.youtube.com/watch?v=hm53n8tqbTo&ab_channel=Exaltitude)
- [🎥 Data Structures and Algorithms in Java | Free course | Animations and Implementations](https://www.youtube.com/watch?v=6iCHf7OZn6c&list=PL6Zs6LgrJj3tDXv8a_elC6eT_4R5gfX4d&ab_channel=DineshVaryani)
- [🎥 Google's Career Page - Interview Tips](https://www.youtube.com/watch?v=VXE1eBIulKg&ab_channel=JeffHSipe-PracticeInterviews)
- [🎥 How to Crack The Coding Interview? | Important LeetCode Questions | Preparation Tips](https://www.youtube.com/watch?v=cM4o7_UY9vM&ab_channel=DineshVaryani)
- [🎥 How To Study For Coding Interviews Efficiently](https://www.youtube.com/watch?v=2nVFdxJJdLw&ab_channel=ConnerArdman)
- [🎥 Joining the Uber Eng Team - Coding Interview](https://www.youtube.com/watch?v=xxAnIoIxWGM)
- [📝 3-month plan for Cracking the Coding Interview](https://medium.com/interviewnoodle/3-month-plan-for-cracking-the-coding-interview-5534f0ad7595)
- [📝 Algorithm Problem Solving](./problem-solving.md)
- [📝 Algorithm Template](https://docs.google.com/document/d/1TKNUaBdgzEoPaD8LNexz9JlquRKc1ZSBnNJuZmhFp4Y/edit)
- [📝 Amazon's Interview Guide](https://www.linkedin.com/posts/arslanahmad_systemdesign-sde-datastructures-activity-7074384240607428608-D9AH)
- [📝 Before the interview](http://blog.gainlo.co/index.php/2017/02/18/chapter-1-get-interview-google-complete-guide-google-interview-preparation)
- [📝 Blind Curated 75](https://leetcode.com/list/x84cr1pj)
- [📝 Brian Bi considerations](https://qr.ae/TSJE9l)
- [📝 Build a Solid Foundation – The Complete Guide to Google Interview Preparation](http://blog.gainlo.co/index.php/2017/02/24/chapter-2-build-solid-foundation-complete-guide-google-interview-preparation)
- [📝 Build a Solid Foundation – The Complete Guide to Google Interview Preparation](http://blog.gainlo.co/index.php/2017/02/24/chapter-2-build-solid-foundation-complete-guide-google-interview-preparation)
- [📝 Coding Interview Prep Guide](https://formation.dev/guide)
- [📝 Crack The Coding Interview Spreadsheet - Leetcode](https://docs.google.com/spreadsheets/d/1pnI8HmSMPcfwrCCu7wYETCXaKDig4VucZDpcjVRuYrE/edit#gid=237636947)
- [📝 Deliberate practice coding interviews](https://www.linkedin.com/feed/update/urn:li:activity:7102397119537303554)
- [📝 Don’t Study 500 LeetCode Problems, Do This Instead](https://medium.com/@brianjenney/dont-study-500-leetcode-problems-do-this-instead-28181ebb1eb1)
- [📝 Facebook Interview Guide](https://www.linkedin.com/posts/arslanahmad_fb-meta-sde-activity-6980448214105669632-5-9e)
- [📝 From Zero to Hero in Problem Solving](https://1162429.medium.com/from-zero-to-hero-in-problem-solving-c616641b5639)
- [📝 Get an Interview with Google – The Complete Guide to Google Interview Preparation](http://blog.gainlo.co/index.php/2017/02/18/chapter-1-get-interview-google-complete-guide-google-interview-preparation)
- [📝 Google devtip: DS & Algorithms](https://techdevguide.withgoogle.com/paths/data-structures-and-algorithms)
- [📝 Google devtip: Interview Prep](https://techdevguide.withgoogle.com/paths/interview)
- [📝 Google devtip: Software Engineering Principles](https://techdevguide.withgoogle.com/paths/principles)
- [📝 Google Interview Guide](https://www.linkedin.com/posts/arslanahmad_google-datastructures-algorithms-activity-7076187648985350144-fYbP)
- [📝 Google Interview Preparation](http://blog.gainlo.co/index.php/category/google-interview-preparation)
- [📝 How I build a habit to leetcode](https://medium.com/@chuayewwee/how-i-build-a-habit-to-leetcode-23b1fdb5e0d9)
- [📝 How to Land a Front-end Software Engineer job at Big Tech Companies such as Google, Facebook, and Twitter](https://javascript.plainenglish.io/how-to-land-a-software-engineer-job-in-google-facebook-and-twitter-44e49906e87)
- [📝 How to study Data Structures and Algorithms while working a full-time job?](https://medium.com/@pepcoding/how-to-study-data-structures-and-algorithms-while-working-a-full-time-job-8ac21c93da5e)
- [📝 knock a technical interview](https://qr.ae/TSJEkK)
- [📝 Meta's Career Page - Interview Prep](https://www.metacareers.com/profile/trial/?redirect=job_details&chooseView=Hello%20World)
- [📝 Microsoft's Interview Guide](https://www.linkedin.com/posts/arslanahmad_microsoft-sde-datastructures-activity-7073219389096947712-ARqi)
- [📝 Must Do Easy Questions](https://leetcode.com/list/xip8yt56)
- [📝 Must Do Medium Questions](https://leetcode.com/list/xineettm)
- [📝 Prep by elliotbot](https://old.reddit.com/r/cscareerquestions/comments/6278bi/my_journey_and_tips_29_gpa_at_a_noname_liberal)
- [📝 Programming Interview Questions](http://www.ardendertat.com/2012/01/09/programming-interview-questions)
- [📝 Recruiter's view](https://qr.ae/TSJE3x)
- [📝 Software Engineer interview preparation](https://www.mauriciopoppe.com/notes/misc/software-engineer-interview-preparation)
- [📝 System Design](./system-design.md)
- [📝 Taejun's preparation](https://qr.ae/TSJEJv)
- [📝 The ultimate guide to preparing for the coding interview](https://medium.com/free-code-camp/the-ultimate-guide-to-preparing-for-the-coding-interview-183251ee36c9)
### Interview
- [🎥 Google Coding Interview](https://www.youtube.com/watch?v=rw4s4M3hFfs&ab_channel=Cl%C3%A9mentMihailescu)
- [📝 A “strong yes” technical interview.](https://medium.com/@paulanthonysalvatore/a-strong-yes-technical-interview-195fb851d836)
- [📝 Green flags in a interview](https://qr.ae/TSJEQA)
### Platforms to learn
- [Cracking the Coding Interview](coding_interviews/cracking-the-coding-interview)
- [Binary Search](https://binarysearch.com)
- [InterviewBit algorithms course](https://www.interviewbit.com/courses/programming)
- [Leetcode Patterns](https://seanprashad.com/leetcode-patterns)
- [Scaler Topics](https://www.scaler.com/topics)
- [Structy](https://structy.net)
- [Leetcode](coding_interviews/leetcode)
- [algoexpert](coding_interviews/algoexpert)
- [LabEx Interview Questions](https://labex.io/interview-questions)
### Competitive Programming
- [Codeforces](competitive-programming/codeforces)
- [Hacker Rank](competitive-programming/hacker-rank)
- [SPOJ BR](competitive-programming/spoj-br)
- [Timus](competitive-programming/timus)
- [UCoder](competitive-programming/ucoder)
- [URI Online Judge](competitive-programming/uri)
- [UVa Online Judge](competitive-programming/uva)
## Computer Science
### Computing
- [🎥 Software as Computational Media](https://www.youtube.com/watch?v=I-aGF-47hqI&ab_channel=ACMSIGPLAN)
- [🎥 Tools & Craft: Andy Matuschak - Software and Computing](https://www.youtube.com/watch?v=bcrcaTuvpBk&ab_channel=Notion)
### Theory
- [🎥 A Unified Theory of Garbage Collection](https://www.youtube.com/watch?v=XtUtfARSIv8&ab_channel=PapersWeLove)
- [📝 Computer Organization - Performance](https://www.csie.nuk.edu.tw/~kcf/course/95_Spring/Organization/Chapter4_Performance.pdf)
- [📝 Computer Organization | Performance of Computer](https://www.geeksforgeeks.org/computer-organization-performance-of-computer)
### Courses
- [🎥 Intro to Theoretical Computer Science](https://classroom.udacity.com/courses/cs313)
- [🎥 MIT 6.042J Mathematics for Computer Science](https://www.youtube.com/playlist?list=PLUl4u3cNGP60UlabZBeeqOuoLuj_KNphQ)
- [🎥 MIT 6.006 Introduction to Algorithms](https://www.youtube.com/playlist?list=PLUl4u3cNGP63EdVPNLG3ToM6LaEUuStEY)
- [🎥 MIT 6.046J Design and Analysis of Algorithms](https://www.youtube.com/playlist?list=PLUl4u3cNGP6317WaSNfmCvGym2ucw3oGp)
## License
[MIT](/LICENSE) © [TK](https://iamtk.co)
</samp>
================================================
FILE: big-o.md
================================================
# Big O
| Big O Notation | Type | Computations for 10 elements | Computations for 100 elements | Computations for 1000 elements |
| -------------- | ----------- | ---------------------------- | ----------------------------- | ------------------------------ |
| **O(1)** | Constant | 1 | 1 | 1 |
| **O(log N)** | Logarithmic | 3 | 6 | 9 |
| **O(N)** | Linear | 10 | 100 | 1000 |
| **O(N log N)** | n log(N) | 30 | 600 | 9000 |
| **O(N^2)** | Quadratic | 100 | 10000 | 1000000 |
| **O(2^N)** | Exponential | 1024 | 1.26e+29 | 1.07e+301 |
| **O(N!)** | Factorial | 3628800 | 9.3e+157 | 4.02e+2567 |
### Data Structure Operations Complexity
| Data Structure | Access | Search | Insertion | Deletion |
| ---------------------- | :----: | :----: | :-------: | :------: |
| **Array** | 1 | N | N | N |
| **Stack** | N | N | 1 | 1 |
| **Queue** | N | N | 1 | 1 |
| **Linked List** | N | N | 1 | N |
| **Hash Table** | 1 | N | N | N |
| **Binary Search Tree** | N | N | N | N |
================================================
FILE: coding_interviews/README.md
================================================
<samp>
# Interview Traning
## Tech Interview Preparation
### Before the interview
- Referral Is The Core
- Talk to some friends at this Tech companies
- Resume
- Concise and easy to understand
- Single page
- Balance between details and simplicity
- Clear to anyone without relevant background and at the same time give people some ideas about the complexity
- Review and feedback
- Technical Questions
- Draw an example:
- Specific. It should use real numbers or strings (if applicable to the problem).
- Sufficiently large. Most examples are too small, by about 50%.
- Not a special case. Be careful. It's very easy to inadvertently draw a special case. If there's any way your example is a special case (even if you think it probably won't be a big deal), you should fix it.
### Build a Solid Foundation
Some questions to have in mind:
- How to do a search in a graph? What are the pros and cons of each approach? How to decide which one to use?
- For a list of objects, you can use linked list, array, stack, queue and other data structures. How would you decide which one to use? What is the biggest advantage/disadvantage?
- What’s the difference between dynamic programming and recursion? How do you compare a recursive solution and its iterative version?
- If I want to improve my solution from O(n^2) time complexity to O(nlogn), what algorithms come to your mind? How about O(n)?
### Algorithm Design Canvas
#### Constraints
- Constraints: Strings, Arrays, Numbers
- range of values: min and max values for any key value
- How many elements can be in the array?
- How large can each element be? If it’s a string, how long? If it’s a number, what is the minimum and maximum value?
- What is in each element? If it’s a number, is it an integer or a floating point? If it’s a string, is it single-byte or multibyte (unicode)?
- If the problem involves finding a subsequence, does “subsequence” mean that the elements must be adjacent, or is there no such requirement?
- Does the array contain unique numbers or can they be repeated (this is sometimes relevant)?
- Constraints: Grids/Mazes
- For problems where some actor (e.g. a robot) is moving in a grid or maze, what moves are allowed? Can the robot move diagonally (hence 8 valid moves), or only horizontally/vertically (hence only 4 valid moves)?
- Are all cells in the grid allowed, or can there be obstacles?
- If the actor is trying to get from cell A to cell B, are cells A and B guaranteed to be different from each other?
- If the actor is trying to get from cell A to cell B, is it guaranteed that there’s a path between the two cells?
- Constraints: Graphs
- How many nodes can the graph have?
- How many edges can the graph have?
- If the edges have weights, what is the range for the weights?
- Can there be loops in the graph? Can there be negative-sum loops in the graph?
- Is the graph directed or undirected?
- Does the graph have multiple edges and/or self-loops?
- Constraints: Return Values
- What should my method return? For example, if I’m trying to find the longest subsequence of increasing numbers in an array, should I return the length, the start index, or both?
- If there are multiple solutions to the problem, which one should be returned?
- If it should return multiple values, do you have any preference on what to return? E.g. should it return an object, a tuple, an array, or pass the output parameters as input references? (This may not be applicable in languages allowing you to return multiple values, e.g. Python)
- What should I do/return if the input is invalid / does not match the constraints? Options may be to do nothing (always assume the input is correct), raise an exception, or return some specific value.
- In problems where you’re supposed to find something (e.g. a number in an array), what should be returned if the element is not present?
### Things to know when stuck
- Always consider hash tables (dictionaries) with their O(1)-ness. ("Tip: using a dictionary is the most common way to get from a brute force approach to something more clever. It should always be your first thought.")
- If at all array-related, try sorting first.
- If search-related, consider binary search.
- Start with a brute force solution, look for repeat work in that solution, and modify it to only do that work once.
Space-time trade-off! That is, for better time complexity, try using auxiliary data structures. E.g., do something in a single pass over an array—O(N) time—by using a hash table—O(N) space—vs. doing something in multiple passes—O(N ^ 2)—without using any extra space—O(1). What information can I store to save time? (Another example: O(1) get_max method for a Stack class stores extra information (the max at and below each element) to save time (instead of iterating through the stack O(N)).)
- Try a greedy solution: Iterate through the problem space taking the optimal solution "so far" until the end. (Optimal if the problem has "optimal substructure," which means stitching together optimal solutions to subproblems yields an optimal solution.)
- Remember that I can use two pointers (e.g., to get the midpoint by having one pointer go twice as fast, or in a sum problem by having the pointers work inward from either end, or to test if a string is a palindrome).
- If the problem involves parsing or tree/graph traversal (or reversal in some way), consider using a stack.
- Does solving the problem for size (N – 1) make solving it for size N any easier? If so, try to solve recursively and/or with dynamic programming. (Using the max/min function can help a lot in recursive or dynamic programming problems.)
- A lot of problems can be treated as graph problems and/or use breadth-first or depth-first traversal.
- If you have a lot of strings, try putting them in a prefix tree / trie.
- Any time you repeatedly have to take the min or max of a dynamic collection, think heaps. (If you don’t need to insert random elements, prefer a sorted array.)
### Common problems and approaches
- subsequence
- consecutive sequence vs non-consecutive sequence
- consecutive sequence: [1, 2, 3] is the consecutive sequence of [1, 2, 3, 4, 5]
- non-consecutive sequence: [1, 3, 5] is the non-consecutive sequence of [1, 2, 3, 4, 5]
- binary search
- [problem](/coding_interviews/leetcode/easy/guess-number-higher-or-lower/guess-number-higher-or-lower.js)
</samp>
================================================
FILE: coding_interviews/algoexpert/README.md
================================================
# AlgoExpert
================================================
FILE: coding_interviews/algoexpert/array-of-products/array-of-products-optimized.js
================================================
/**
*
* Write a function that takes in a non-empty array of integers and returns
* an array of the same length, where each element in the output array is
* equal to the product of every other number in the input array.
* In other words, the value at output[i] is equal to the product of
* every number in the input array other than input[i].
* Note that you're expected to solve this problem without using division.
*
* Input: array = [5, 1, 4, 2]
* Output: [8, 40, 10, 20]
*/
// Runtime: O(N), N = length of array
// Space: O(N)
function initOutput(length) {
let output = [];
while (length--) {
output.push(1);
}
return output;
}
function arrayOfProducts(array) {
let left = 1;
let right = 1;
let length = array.length;
let output = initOutput(length);
for (let index = 0; index < length; index++) {
output[index] *= left;
output[length - index - 1] *= right;
left *= array[index];
right *= array[length - index - 1];
}
return output;
}
================================================
FILE: coding_interviews/algoexpert/array-of-products/array-of-products.js
================================================
/**
*
* Write a function that takes in a non-empty array of integers and returns
* an array of the same length, where each element in the output array is
* equal to the product of every other number in the input array.
* In other words, the value at output[i] is equal to the product of
* every number in the input array other than input[i].
* Note that you're expected to solve this problem without using division.
*
* Input: array = [5, 1, 4, 2]
* Output: [8, 40, 10, 20]
*/
// Runtime: O(N^2), N = length of array
// Space: O(N)
function initOutput(length) {
let output = [];
while (length--) {
output.push(1);
}
return output;
}
function arrayOfProducts(array) {
let output = initOutput(array.length);
for (let index = 0; index < array.length; index++) {
for (let outputIndex = 0; outputIndex < output.length; outputIndex++) {
if (index !== outputIndex) {
output[outputIndex] *= array[index];
}
}
}
return output;
}
================================================
FILE: coding_interviews/algoexpert/best-seat/best-seat.js
================================================
/**
* You walk into a theatre you're about to see a show in. The usher within
* the theatre walks you to your row and mentions you're allowed to sit
* anywhere within the given row. Naturally you'd like to sit in the seat
* that gives you the most space. You also would prefer this space to be
* evenly distributed on either side of you (e.g. if there are three empty
* seats in a row, you would prefer to sit in the middle of those three seats).
* Given the theatre row represented as an integer array, return the seat
* index of where you should sit. Ones represent occupied seats and zeroes
* represent empty seats.
*
* You may assume that someone is always sitting in the first and last seat
* of the row. Whenever there are two equally good seats, you should sit in
* the seat with the lower index. If there is no seat to sit in, return -1.
* The given array will always have a length of at least one and contain only
* ones and zeroes.
*
* Input: seats = [1, 0, 1, 0, 0, 0, 1]
* Output: 4
*/
// Runtime: O(N), N = seats length
// Space: O(1)
function bestSeat(seats) {
let sequenceIndex;
let sequenceIndexTemp;
let sequenceLength = 0;
let maxSequenceLength = 0;
for (let index = 1; index < seats.length; index++) {
let seat = seats[index];
if (seat === 0) {
sequenceLength++;
if (!sequenceIndexTemp) {
sequenceIndexTemp = index;
}
} else {
if (sequenceLength > maxSequenceLength) {
maxSequenceLength = sequenceLength;
sequenceIndex = sequenceIndexTemp;
}
sequenceLength = 0;
sequenceIndexTemp = undefined;
}
}
if (maxSequenceLength <= 0) {
return -1;
}
return maxSequenceLength % 2 === 0
? sequenceIndex + Math.floor(maxSequenceLength / 2) - 1
: sequenceIndex + Math.floor(maxSequenceLength / 2);
}
================================================
FILE: coding_interviews/algoexpert/binary-search/binary-search.js
================================================
// Runtime: O(logN)
// Space: O(1)
function binarySearch(array, target) {
let start = 0;
let end = array.length - 1;
let middle = Math.floor((start + end) / 2);
while (start <= end) {
let num = array[middle];
if (num === target) {
return middle;
}
if (num > target) {
end = middle - 1;
}
if (num < target) {
start = middle + 1;
}
middle = Math.floor((start + end) / 2);
}
return -1;
}
================================================
FILE: coding_interviews/algoexpert/branch-sums/branch-sums-without-recreating-sums.js
================================================
// Runtime: O(N), N = number of nodes
// Space: list of branch sums (number of leaf nodes) is O(N) and recursive algorithm (call stack) is log(N)
class BinaryTree {
constructor(value) {
this.value = value;
this.left = null;
this.right = null;
}
}
function branchSums(root) {
let sums = [];
const recursiveBranchSums = (node, sum) => {
if (!node) return;
let newSum = sum + node.value;
if (!node.left && !node.right) return sums.push(newSum);
recursiveBranchSums(node.left, newSum);
recursiveBranchSums(node.right, newSum);
};
recursiveBranchSums(root, 0);
return sums;
}
================================================
FILE: coding_interviews/algoexpert/branch-sums/branch-sums.js
================================================
// Runtime: O(N), N = number of nodes
// Space: list of branch sums (number of leaf nodes) is O(N) and recursive algorithm (call stack) is log(N)
class BinaryTree {
constructor(value) {
this.value = value;
this.left = null;
this.right = null;
}
}
function branchSums(root, sum = 0, sums = []) {
if (!root) return sums;
if (!root.left && !root.right) return [...sums, sum + root.value];
let newSum = sum + root.value;
let leftBranch = branchSums(root.left, newSum, sums);
let rightBranch = branchSums(root.right, newSum, sums);
return [...leftBranch, ...rightBranch];
}
================================================
FILE: coding_interviews/algoexpert/bst-construction/bst-construction.js
================================================
/**
BST Construction
Write a BST class for a Binary Search Tree. The class should support:
Inserting values with the insert method.
Removing values with the remove method; this method should only remove the first instance of a given value.
Searching for values with the contains method.
Note that you can't remove values from a single-node tree.
In other words, calling the remove method on a single-node tree should simply not do anything.
Each BST node has an integer value, a left child node, and a right child node.
A node is said to be a valid BST node if and only if it satisfies the BST property:
its value is strictly greater than the values of every node to its left;
its value is less than or equal to the values of every node to its right;
and its children nodes are either valid BST nodes themselves or None / null.
*/
class BST {
constructor(value) {
this.value = value;
this.left = null;
this.right = null;
}
insert(value) {
if (value < this.value) {
if (this.left) this.left.insert(value);
else this.left = new BST(value);
} else {
if (this.right) this.right.insert(value);
else this.right = new BST(value);
}
return this;
}
contains(value) {
if (this.value === value) {
return true;
}
if (value < this.value) {
return this.left ? this.left.contains(value) : false;
}
if (value >= this.value) {
return this.right ? this.right.contains(value) : false;
}
return false;
}
remove(value, parent = null) {
if (parent === null && this.left === null && this.right === null) return;
if (value === this.value) {
// when the node has children:
// get the smallest node from the right subtree and replace the removed node with this one
if (this.left && this.right) {
let smallestNodeValue = this.right._findSmallestNodeValue();
this.right.remove(smallestNodeValue, this);
this.value = smallestNodeValue;
return this;
}
// when the node to be removed is a leaf node: just remove it
if (!this.left && !this.right) {
if (parent.left === this) parent.left = null;
if (parent.right === this) parent.right = null;
}
// when the node to be removed only has one child node: point child node to the parent
if (this.left) {
let greatestNodeValue = this.left._findGreatestNodeValue();
this.value = greatestNodeValue;
this.left.remove(greatestNodeValue, this);
}
// when the node to be removed only has one child node: point child node to the parent
if (this.right) {
let smallestNodeValue = this.right._findSmallestNodeValue();
this.value = smallestNodeValue;
this.right.remove(smallestNodeValue, this);
}
}
if (value < this.value) {
if (this.left) {
this.left.remove(value, this);
}
}
if (value >= this.value) {
if (this.right) {
this.right.remove(value, this);
}
}
return this;
}
_findSmallestNodeValue() {
return this.left ? this.left._findSmallestNodeValue() : this.value;
}
_findGreatestNodeValue() {
return this.right ? this.right._findGreatestNodeValue() : this.value;
}
}
================================================
FILE: coding_interviews/algoexpert/bst-traversal/bst-traversal.js
================================================
function inOrderTraverse(tree, array) {
if (!tree) return;
inOrderTraverse(tree.left, array);
array.push(tree.value);
inOrderTraverse(tree.right, array);
return array;
}
function preOrderTraverse(tree, array) {
if (!tree) return;
array.push(tree.value);
preOrderTraverse(tree.left, array);
preOrderTraverse(tree.right, array);
return array;
}
function postOrderTraverse(tree, array) {
if (!tree) return;
postOrderTraverse(tree.left, array);
postOrderTraverse(tree.right, array);
array.push(tree.value);
return array;
}
================================================
FILE: coding_interviews/algoexpert/bubble-sort/bubble-sort.js
================================================
// Runtime: O(N^2)
// Space: O(1)
function bubbleSort(array) {
let sorted = false;
while (!sorted) {
sorted = true;
for (let index = 0; index < array.length - 1; index++) {
if (array[index] > array[index + 1]) {
let aux = array[index];
array[index] = array[index + 1];
array[index + 1] = aux;
sorted = false;
}
}
}
return array;
}
================================================
FILE: coding_interviews/algoexpert/caesar-cipher-encryptor/caesar-cipher-encryptor.js
================================================
// Runtime: O(N), N = number of characters
// Space: O(N)
function getChar(char, key) {
let charCode = ((char.charCodeAt() - 97 + key) % 26) + 97;
return String.fromCharCode(charCode);
}
function caesarCipherEncryptor(string, key) {
return [...string].map((char) => getChar(char, key)).join('');
}
================================================
FILE: coding_interviews/algoexpert/class-photos/class-photos.js
================================================
function classPhotos(redShirtHeights, blueShirtHeights) {
redShirtHeights.sort((a, b) => a - b);
blueShirtHeights.sort((a, b) => a - b);
let backRow;
let frontRow;
if (redShirtHeights[0] < blueShirtHeights[0]) {
backRow = blueShirtHeights;
frontRow = redShirtHeights;
} else {
backRow = redShirtHeights;
frontRow = blueShirtHeights;
}
for (let index = 0; index < backRow.length; index++) {
if (frontRow[index] >= backRow[index]) return false;
}
return true;
}
================================================
FILE: coding_interviews/algoexpert/common-characters/common-characters.js
================================================
// Runtime: (N * M), N = number of strings and M = length of biggest string
// Space: (M), M = length of biggest string
/**
* Write a function that takes in a non-empty list of non-empty strings and returns
* a list of characters that are common to all strings in the list, ignoring multiplicity.
* Note that the strings are not guaranteed to only contain alphanumeric characters.
* The list you return can be in any order.
*
* Input:
* strings = ["abc", "bcd", "cbaccd"]
*
* Output:
* ["b", "c"] // The characters could be ordered differently.
*/
function commonCharacters(strings) {
let map = new Map();
let result = [];
for (let string of strings) {
let set = new Set(string);
for (let char of set) {
map.set(char, map.get(char) + 1 || 1);
}
}
for (let [char, count] of map) {
if (count === strings.length) {
result.push(char);
}
}
return result;
}
================================================
FILE: coding_interviews/algoexpert/depth-first-search/depth-first-search-cleaner.js
================================================
// Runtime: O(V + E), V = vertices, E = edges
// Space: O(V), V = vertices
class Node {
constructor(name) {
this.name = name;
this.children = [];
}
addChild(name) {
this.children.push(new Node(name));
return this;
}
depthFirstSearch(array) {
array.push(this.name);
for (let child of this.children) {
child.depthFirstSearch(array);
}
return array;
}
}
================================================
FILE: coding_interviews/algoexpert/depth-first-search/depth-first-search.js
================================================
// Runtime: O(V + E), V = vertices, E = edges
// Space: O(V), V = vertices
class Node {
constructor(name) {
this.name = name;
this.children = [];
}
addChild(name) {
this.children.push(new Node(name));
return this;
}
depthFirstSearch(array) {
let queue = [this];
while (queue.length) {
let node = queue.shift();
array.push(node.name);
for (let child of node.children) {
child.depthFirstSearch(array);
}
}
return array;
}
}
================================================
FILE: coding_interviews/algoexpert/evaluate-expression-tree/evaluate-expression-tree-cleaner.js
================================================
function evaluateExpressionTree({value, left, right}) {
if (value === -1) return evaluateExpressionTree(left) + evaluateExpressionTree(right);
if (value === -2) return evaluateExpressionTree(left) - evaluateExpressionTree(right);
if (value === -3) return Math.trunc(evaluateExpressionTree(left) / evaluateExpressionTree(right));
if (value === -4) return evaluateExpressionTree(left) * evaluateExpressionTree(right);
return value;
}
================================================
FILE: coding_interviews/algoexpert/evaluate-expression-tree/evaluate-expression-tree-with-trunc.js
================================================
function evaluateExpressionTree(tree) {
if (!tree) return null;
let leftValue = evaluateExpressionTree(tree.left);
let rightValue = evaluateExpressionTree(tree.right);
if (!leftValue && !rightValue) return tree.value;
if (tree.value === -1) return leftValue + rightValue;
if (tree.value === -2) return leftValue - rightValue;
if (tree.value === -3) return Math.trunc(leftValue / rightValue);
if (tree.value === -4) return leftValue * rightValue;
}
================================================
FILE: coding_interviews/algoexpert/evaluate-expression-tree/evaluate-expression-tree.js
================================================
function evaluateExpressionTree(tree) {
if (!tree) return null;
let leftValue = evaluateExpressionTree(tree.left);
let rightValue = evaluateExpressionTree(tree.right);
if (!leftValue && !rightValue) return tree.value;
if (tree.value === -1) return leftValue + rightValue;
if (tree.value === -2) return leftValue - rightValue;
if (tree.value === -3) {
let value = leftValue / rightValue;
return Math.sign(value) * Math.floor(Math.abs(value));
}
if (tree.value === -4) return leftValue * rightValue;
}
================================================
FILE: coding_interviews/algoexpert/find-closest-value-in-bst/find-closest-value-in-bst-optimized-cleaner.js
================================================
// Runtime
// - average: O(logN), where N = number of nodes in the tree
// - worst case: O(N), where N = number of nodes in the tree
// Space: O(1)
function abs(value) {
return Math.abs(value);
}
function findClosestValueInBst(tree, target, closest = Infinity) {
if (!tree) {
return closest;
}
if (abs(tree.value - target) < abs(closest - target)) {
closest = tree.value;
}
if (target === tree.value) {
return closest;
}
if (target < tree.value) {
return findClosestValueInBst(tree.left, target, closest);
}
return findClosestValueInBst(tree.right, target, closest);
}
================================================
FILE: coding_interviews/algoexpert/find-closest-value-in-bst/find-closest-value-in-bst-optimized.js
================================================
// Runtime
// - average: O(logN), where N = number of nodes in the tree
// - worst case: O(N), where N = number of nodes in the tree
// Space: O(1)
function findClosestValueInBst(tree, target, closestValue = Infinity) {
if (!tree) {
return closestValue;
}
if (tree.value === target) {
return target;
}
let currentDiff = Math.abs(tree.value - target);
let diff = Math.abs(closestValue - target);
let newClosestValue = currentDiff <= diff ? tree.value : closestValue;
let leftValue =
target < tree.value
? findClosestValueInBst(tree.left, target, newClosestValue)
: newClosestValue;
let rightValue =
target > tree.value
? findClosestValueInBst(tree.right, target, newClosestValue)
: newClosestValue;
let leftDiff = Math.abs(leftValue - target);
let rightDiff = Math.abs(rightValue - target);
if (currentDiff <= leftDiff && currentDiff <= rightDiff) {
return tree.value;
} else if (leftDiff <= rightDiff) {
return leftValue;
}
return rightValue;
}
================================================
FILE: coding_interviews/algoexpert/find-closest-value-in-bst/find-closest-value-in-bst.js
================================================
// Runtime: O(N), where N = number of nodes in the tree
// Space: O(1)
function findClosestValueInBst(tree, target, closestValue = Infinity) {
if (!tree) {
return closestValue;
}
let currentDiff = Math.abs(tree.value - target);
let diff = Math.abs(closestValue - target);
let leftValue = findClosestValueInBst(
tree.left,
target,
currentDiff <= diff ? tree.value : closestValue
);
let rightValue = findClosestValueInBst(
tree.right,
target,
currentDiff <= diff ? tree.value : closestValue
);
let leftDiff = Math.abs(leftValue - target);
let rightDiff = Math.abs(rightValue - target);
if (currentDiff <= leftDiff && currentDiff <= rightDiff) {
return tree.value;
} else if (leftDiff <= rightDiff) {
return leftValue;
}
return rightValue;
}
================================================
FILE: coding_interviews/algoexpert/find-three-largest-numbers/find-three-largest-numbers.js
================================================
// Runtime: O(N), N = number of numbers in the array
// Space: O(1)
function findThreeLargestNumbers(array) {
let first = -Infinity;
let second = -Infinity;
let third = -Infinity;
for (let num of array) {
if (num > first) {
third = second;
second = first;
first = num;
} else if (num > second) {
third = second;
second = num;
} else if (num > third) {
third = num;
}
}
return [third, second, first];
}
================================================
FILE: coding_interviews/algoexpert/first-duplicate-value/first-duplicate-value-optimized.js
================================================
/**
* Given an array of integers between 1 and n, inclusive, where n is the length of
* the array, write a function that returns the first integer that appears more
* than once (when the array is read from left to right).
* In other words, out of all the integers that might occur more than once in the
* input array, your function should return the one whose first duplicate
* value has the minimum index.
* If no integer appears more than once, your function should return -1.
* Note that you're allowed to mutate the input array.
*
* Input: array = [2, 1, 5, 2, 3, 3, 4]
* Output: 2
*/
// Runtime: O(N), N = array length
// Space: O(1)
function firstDuplicateValue(array) {
for (let index = 0; index < array.length; index++) {
let newIndex = Math.abs(array[index]) - 1;
if (array[newIndex] < 0) {
return Math.abs(array[index]);
}
array[newIndex] = array[newIndex] * -1;
}
return -1;
}
================================================
FILE: coding_interviews/algoexpert/first-duplicate-value/first-duplicate-value.js
================================================
/**
* Given an array of integers between 1 and n, inclusive, where n is the length of
* the array, write a function that returns the first integer that appears more
* than once (when the array is read from left to right).
* In other words, out of all the integers that might occur more than once in the
* input array, your function should return the one whose first duplicate
* value has the minimum index.
* If no integer appears more than once, your function should return -1.
* Note that you're allowed to mutate the input array.
*
* Input: array = [2, 1, 5, 2, 3, 3, 4]
* Output: 2
*/
// Runtime: O(N), N = array length
// Space: O(N)
function firstDuplicateValue(array) {
let map = new Map();
for (let num of array) {
map.set(num, map.get(num) + 1 || 1);
if (map.get(num) > 1) {
return num;
}
}
return -1;
}
================================================
FILE: coding_interviews/algoexpert/first-non-repeating-character/first-non-repeating-character.js
================================================
// Runtime: O(N), N = string length
// Space: O(N)
function firstNonRepeatingCharacter(string) {
let map = new Map();
for (let char of string) {
map.set(char, map.get(char) + 1 || 1);
}
for (let index = 0; index < string.length; index++) {
if (map.get(string[index]) <= 1) return index;
}
return -1;
}
================================================
FILE: coding_interviews/algoexpert/generate-document/generate-document.js
================================================
/**
*
* You're given a string of available characters and a string representing a document that you need to generate.
* Write a function that determines if you can generate the document using the available characters.
* If you can generate the document, your function should return true; otherwise, it should return false.
* You're only able to generate the document if the frequency of unique characters in the characters string
* is greater than or equal to the frequency of unique characters in the document string.
* For example, if you're given characters = "abcabc" and document = "aabbccc" you cannot generate
* the document because you're missing one c.
* The document that you need to create may contain any characters, including special characters,
* capital letters, numbers, and spaces.
* Note: you can always generate the empty string ("").
*
* Input:
* characters = "Bste!hetsi ogEAxpelrt x "
* document = "AlgoExpert is the Best!"
*
* Output:
* true
*/
function generateDocument(characters, document) {
let map = new Map();
for (let char of characters) {
map.set(char, map.get(char) + 1 || 1);
}
for (let char of document) {
if (map.has(char) && map.get(char) > 0) {
map.set(char, map.get(char) - 1);
} else {
return false;
}
}
return true;
}
================================================
FILE: coding_interviews/algoexpert/insertion-sort/insertion-sort.js
================================================
// Runtime: O(N^2)
// Space: O(1)
function swap(array, i, j) {
let aux = array[i];
array[i] = array[j];
array[j] = aux;
}
function insertionSort(array) {
for (let index = 0; index < array.length; index++) {
let toSwapIndex = index;
while (toSwapIndex > 0 && array[toSwapIndex] < array[toSwapIndex - 1]) {
swap(array, toSwapIndex, toSwapIndex - 1);
toSwapIndex -= 1;
}
}
return array;
}
================================================
FILE: coding_interviews/algoexpert/longest-peak/longest-peak.js
================================================
/**
* Write a function that takes in an array of integers and returns
* the length of the longest peak in the array.
* A peak is defined as adjacent integers in the array that are
* strictly increasing until they reach a tip (the highest value in
* the peak), at which point they become strictly decreasing.
* At least three integers are required to form a peak.
* For example, the integers 1, 4, 10, 2 form a peak, but the
* integers 4, 0, 10 don't and neither do the integers 1, 2, 2, 0.
* Similarly, the integers 1, 2, 3 don't form a peak because there
* aren't any strictly decreasing integers after the 3.
*
* Input: array = [1, 2, 3, 3, 4, 0, 10, 6, 5, -1, -3, 2, 3]
* Output: 6 // 0, 10, 6, 5, -1, -3
*/
// Runtime: O(N), N = array length
// Space: O(1)
function longestPeak(array) {
let longestPeak = 0;
let leftEdge;
let rightEdge;
for (let peakIndex = 1; peakIndex < array.length - 1; peakIndex++) {
if (
array[peakIndex] > array[peakIndex - 1] &&
array[peakIndex] > array[peakIndex + 1]
) {
for (let index = peakIndex; index > 0; index--) {
if (array[index - 1] < array[index]) {
leftEdge = index - 1;
} else {
break;
}
}
for (let index = peakIndex; index < array.length - 1; index++) {
if (array[index] > array[index + 1]) {
rightEdge = index + 1;
} else {
break;
}
}
longestPeak = Math.max(longestPeak, rightEdge - leftEdge + 1);
}
}
return longestPeak;
}
================================================
FILE: coding_interviews/algoexpert/majority-element/majority-element.js
================================================
// Runtime: O(N^2)
// Space: O(N)
function majorityElement(array) {
let half = Math.floor(array.length / 2);
if (array.length <= 1) return array[0];
for (let i = 0; i < array.length; i++) {
let count = 1;
let number = array[i];
for (let k = i + 1; k < array.length; k++) {
if (array[k] === number) {
count++;
}
if (count > half) {
return number;
}
}
}
}
================================================
FILE: coding_interviews/algoexpert/merge-overlapping-intervals/merge-overlapping-intervals.js
================================================
/**
* Write a function that takes in a non-empty array of arbitrary intervals,
* merges any overlapping intervals, and returns the new intervals in no
* particular order.
* Each interval interval is an array of two integers, with interval[0] as
* the start of the interval and interval[1] as the end of the interval.
* Note that back-to-back intervals aren't considered to be overlapping.
* For example, [1, 5] and [6, 7] aren't overlapping; however, [1, 6] and
* [6, 7] are indeed overlapping.
* Also note that the start of any particular interval will always be
* less than or equal to the end of that interval.
*
* Input: intervals = [[1, 2], [3, 5], [4, 7], [6, 8], [9, 10]]
* Output: [[1, 2], [3, 8], [9, 10]]
*/
// Runtime: O(NlogN), N = array length
// Space: O(N)
function mergeOverlappingIntervals(array) {
if (array.length <= 1) return array;
array.sort((a, b) => a[0] - b[0]);
let intervals = [];
let current = array[0];
for (let index = 1; index < array.length; index++) {
let next = array[index];
if (current[1] >= next[0]) {
current = [current[0], Math.max(current[1], next[1])];
} else {
intervals.push(current);
current = next;
}
if (index === array.length - 1) {
intervals.push(current);
}
}
return intervals;
}
================================================
FILE: coding_interviews/algoexpert/middle-node/middle-node-slow-fast.js
================================================
// Runtime: O(N), N = number of nodes in the linked list
// Space: O(1)
function middleNode(linkedList) {
let fast = linkedList;
let slow = linkedList;
while (fast && fast.next) {
fast = fast.next.next;
slow = slow.next;
}
return slow;
}
================================================
FILE: coding_interviews/algoexpert/middle-node/middle-node.js
================================================
// Runtime: O(N), N = number of nodes in the linked list
// Space: O(1)
function middleNode(linkedList) {
let length = 0;
let node = linkedList;
while (linkedList) {
linkedList = linkedList.next;
length++;
}
let middle = Math.floor(length / 2);
let index = 0;
while (node) {
if (index === middle) {
return node;
}
node = node.next;
index++;
}
}
================================================
FILE: coding_interviews/algoexpert/minimum-waiting-time/minimum-waiting-time.js
================================================
function minimumWaitingTime(queries) {
let waitingTime = 0;
let previous = 0;
queries.sort((a, b) => a - b);
for (let query of queries) {
waitingTime += previous;
previous += query;
}
return waitingTime;
}
================================================
FILE: coding_interviews/algoexpert/missing-numbers/missing-numbers.js
================================================
// Runtime: O(N)
// Space: O(N)
function missingNumbers(nums) {
let numbers = [];
for (let index = 0; index < nums.length + 2; index++) {
numbers.push(index + 1);
}
for (let num of nums) {
numbers[num - 1] = 0;
}
let result = [];
for (let num of numbers) {
if (num) result.push(num);
}
return result;
}
================================================
FILE: coding_interviews/algoexpert/monotonic-array/monotonic-array-optimization-1.js
================================================
/**
* Write a function that takes in an array of integers and returns a boolean
* representing whether the array is monotonic.
* An array is said to be monotonic if its elements, from left to right, are
* entirely non-increasing or entirely non-decreasing.
* Non-increasing elements aren't necessarily exclusively decreasing; they
* simply don't increase. Similarly, non-decreasing elements aren't necessarily
* exclusively increasing; they simply don't decrease.
* Note that empty arrays and arrays of one element are monotonic.
*
* Input:
* array = [-1, -5, -10, -1100, -1100, -1101, -1102, -9001]
*
* Output:
* true
*/
// Runtime: O(N), N = array length
// Space: O(1)
function isMonotonic(array) {
let num = array[0];
let upward;
for (let index = 1; index < array.length; index++) {
if (upward === undefined) {
upward = array[index] !== num ? array[index] > num : undefined;
}
if (upward !== undefined && upward && array[index] < num) {
return false;
}
if (upward !== undefined && !upward && array[index] > num) {
return false;
}
num = array[index];
}
return true;
}
================================================
FILE: coding_interviews/algoexpert/monotonic-array/monotonic-array-optimization-2.js
================================================
/**
* Write a function that takes in an array of integers and returns a boolean
* representing whether the array is monotonic.
* An array is said to be monotonic if its elements, from left to right, are
* entirely non-increasing or entirely non-decreasing.
* Non-increasing elements aren't necessarily exclusively decreasing; they
* simply don't increase. Similarly, non-decreasing elements aren't necessarily
* exclusively increasing; they simply don't decrease.
* Note that empty arrays and arrays of one element are monotonic.
*
* Input:
* array = [-1, -5, -10, -1100, -1100, -1101, -1102, -9001]
*
* Output:
* true
*/
// Runtime: O(N), N = array length
// Space: O(1)
function isMonotonic(array) {
let isNonDecreasing = true;
let isNonIncreasing = true;
for (let index = 0; index < array.length - 1; index++) {
if (array[index] > array[index + 1]) isNonDecreasing = false;
if (array[index] < array[index + 1]) isNonIncreasing = false;
}
return isNonDecreasing || isNonIncreasing;
}
================================================
FILE: coding_interviews/algoexpert/monotonic-array/monotonic-array.js
================================================
/**
* Write a function that takes in an array of integers and returns a boolean
* representing whether the array is monotonic.
* An array is said to be monotonic if its elements, from left to right, are
* entirely non-increasing or entirely non-decreasing.
* Non-increasing elements aren't necessarily exclusively decreasing; they
* simply don't increase. Similarly, non-decreasing elements aren't necessarily
* exclusively increasing; they simply don't decrease.
* Note that empty arrays and arrays of one element are monotonic.
*
* Input:
* array = [-1, -5, -10, -1100, -1100, -1101, -1102, -9001]
*
* Output:
* true
*/
// Runtime: O(N), N = array length
// Space: O(1)
function isNonIncreasing(array) {
let num = array[0];
for (let index = 1; index < array.length; index++) {
if (array[index] > num) {
return false;
}
num = array[index];
}
return true;
}
function isNonDecreasing(array) {
let num = array[0];
for (let index = 1; index < array.length; index++) {
if (array[index] < num) {
return false;
}
num = array[index];
}
return true;
}
function isMonotonic(array) {
return isNonIncreasing(array) || isNonDecreasing(array);
}
================================================
FILE: coding_interviews/algoexpert/move-element-to-end/move-element-to-end.js
================================================
/**
* You're given an array of integers and an integer. Write a function that
* moves all instances of that integer in the array to the end of the
* array and returns the array.
* The function should perform this in place (i.e., it should mutate the input array)
* and doesn't need to maintain the order of the other integers.
*
* Input:
* array = [2, 1, 2, 2, 2, 3, 4, 2]
* toMove = 2
*
* Output:
* [1, 3, 4, 2, 2, 2, 2, 2]
*/
// Runtime: O(2N) = O(N), where N = array length
// Space: O(1)
function moveElementToEnd(array, toMove) {
let pointer = 0;
for (let index = 0; index < array.length; index++) {
if (array[index] !== toMove) {
array[pointer] = array[index];
pointer++;
}
}
for (let index = pointer; index < array.length; index++) {
array[index] = toMove;
}
return array;
}
================================================
FILE: coding_interviews/algoexpert/node-depths/node-depths.js
================================================
// Runtime: O(N), N = number of nodes
// Space: O(H), H = height of the tree
function nodeDepths(root, sum = 0) {
if (!root) return 0;
return sum + nodeDepths(root.left, sum + 1) + nodeDepths(root.right, sum + 1);
}
================================================
FILE: coding_interviews/algoexpert/non-constructible-change/non-constructible-change.js
================================================
// Runtime: O(nlogn)
// Space: O(1)
function nonConstructibleChange(coins) {
coins.sort((a, b) => a - b);
let currentChangeCreated = 0;
for (let coin of coins) {
if (coin > currentChangeCreated + 1) {
return currentChangeCreated + 1;
}
currentChangeCreated += coin;
}
return currentChangeCreated + 1;
}
================================================
FILE: coding_interviews/algoexpert/nth-fibonacci/nth-fibonacci-memo-no-space.js
================================================
// Runtime: O(N)
// Space: O(1)
function getNthFib(n) {
if (n === 1) return 0;
if (n === 2) return 1;
let first = 0;
let second = 1;
for (let num = 3; num <= n; num++) {
let sum = first + second;
first = second;
second = sum;
}
return second;
}
================================================
FILE: coding_interviews/algoexpert/nth-fibonacci/nth-fibonacci-memo.js
================================================
// Runtime: O(N)
// Space: O(N)
function getNthFib(n) {
if (n === 1) return 0;
if (n === 2) return 1;
let memo = [0, 0, 1];
let result;
for (let num = 3; num <= n; num++) {
result = memo[num - 1] + memo[num - 2];
memo.push(result);
}
return result;
}
================================================
FILE: coding_interviews/algoexpert/nth-fibonacci/nth-fibonacci.js
================================================
// Runtime: O(2^N)
// Space: O(N)
function getNthFib(n) {
if (n === 0) return 0;
if (n === 1) return 0;
if (n === 2) return 1;
return getNthFib(n - 1) + getNthFib(n - 2);
}
================================================
FILE: coding_interviews/algoexpert/optimal-freelancing/optimal-freelancing-sorting.js
================================================
function sortJobs(jobs) {
jobs.sort((job1, job2) => {
if (job1.payment > job2.payment) return -1;
if (job1.payment < job2.payment) return 1;
return 0;
});
}
function optimalFreelancing(jobs) {
let profit = 0;
let days = [0, 0, 0, 0, 0, 0, 0];
sortJobs(jobs);
for (let { deadline, payment } of jobs) {
let maxTime = Math.min(deadline, 7);
for (let time = maxTime; time >= 1; time--) {
if (days[time - 1] === 0) {
profit += payment;
days[time - 1] = payment;
break;
}
}
}
return profit;
}
================================================
FILE: coding_interviews/algoexpert/optimal-freelancing/optimal-freelancing.js
================================================
function optimalFreelancing(jobs) {
let profit = 0;
let day = 7;
let completedJobs = new WeakSet();
while (day > 0) {
let bestJob;
for (let job of jobs) {
if (
job.deadline >= day &&
job.payment > (bestJob?.payment || 0) &&
!completedJobs.has(job)
) {
bestJob = job;
}
}
day--;
if (bestJob) {
completedJobs.add(bestJob);
profit += bestJob.payment;
}
}
return profit;
}
================================================
FILE: coding_interviews/algoexpert/palindrome-check/palindrome-check.js
================================================
// Runtime: O(N), N = characters in the string
// Space: O(1)
function isPalindrome(string) {
let start = 0;
let end = string.length - 1;
let middle = Math.floor((start + end) / 2);
while (start <= middle && end >= middle) {
if (string[start] !== string[end]) {
return false;
}
start++;
end--;
}
return true;
}
================================================
FILE: coding_interviews/algoexpert/product-sum/product-sum-timer-later.js
================================================
// Runtime: O(N), N = all numbers including the numbers inside nested arrays
// Space: O(D), D = the depth of the nested arrays
function productSum(array, depth = 1) {
let sum = 0;
for (let num of array) {
if (Array.isArray(num)) {
sum += productSum(num, depth + 1);
} else {
sum += num;
}
}
return sum * depth;
}
================================================
FILE: coding_interviews/algoexpert/product-sum/product-sum.js
================================================
// Runtime: O(N), N = all numbers including the numbers inside nested arrays
// Space: O(D), D = the depth of the nested arrays
function productSum(array, product = 1) {
let sum = 0;
for (let num of array) {
if (Array.isArray(num)) {
sum += productSum(num, product + 1) * product;
} else {
sum += num * product;
}
}
return sum;
}
================================================
FILE: coding_interviews/algoexpert/remove-duplicates-from-linked-list/remove-duplicates-from-linked-list.js
================================================
// Runtime: O(N), N = number of nodes in the linked list
// Space: O(1)
function removeDuplicatesFromLinkedList(linkedList) {
let head = linkedList;
while (linkedList) {
let next = linkedList.next;
while (next && linkedList.value === next.value) {
next = next.next;
}
linkedList.next = next;
linkedList = next;
}
return head;
}
================================================
FILE: coding_interviews/algoexpert/remove-islands/remove-islands-optimized.js
================================================
/**
You're given a two-dimensional array (a matrix) of potentially unequal height and width containing only 0s and 1s.
The matrix represents a two-toned image, where each 1 represents black and each 0 represents white.
An island is defined as any number of 1s that are horizontally or vertically adjacent (but not diagonally adjacent)
and that don't touch the border of the image. In other words, a group of horizontally or vertically adjacent 1s isn't an island
if any of those 1s are in the first row, last row, first column, or last column of the input matrix.
Note that an island can twist. In other words, it doesn't have to be a straight vertical line or a straight horizontal line;
it can be L-shaped, for example.
You can think of islands as patches of black that don't touch the border of the two-toned image.
Write a function that returns a modified version of the input matrix, where all of the islands are removed.
You remove an island by replacing it with 0s.
Naturally, you're allowed to mutate the input matrix.
*/
function markNonIsland(matrix, rowIndex, colIndex) {
if (
rowIndex < 0 ||
rowIndex >= matrix.length ||
colIndex < 0 ||
colIndex >= matrix[rowIndex].length ||
[0, 2].includes(matrix[rowIndex][colIndex])
) {
return;
}
matrix[rowIndex][colIndex] = 2;
markNonIsland(matrix, rowIndex - 1, colIndex); // top
markNonIsland(matrix, rowIndex + 1, colIndex); // bottom
markNonIsland(matrix, rowIndex, colIndex - 1); // left
markNonIsland(matrix, rowIndex, colIndex + 1); // right
}
function removeIslands(matrix) {
const lastRowIndex = matrix.length - 1;
const lastColIndex = matrix[0].length - 1;
for (let colIndex = 0; colIndex < matrix[0].length; colIndex++) {
if (matrix[0][colIndex] === 1) markNonIsland(matrix, 0, colIndex);
if (matrix[lastRowIndex][colIndex] === 1)
markNonIsland(matrix, lastRowIndex, colIndex);
}
for (let rowIndex = 0; rowIndex < matrix.length; rowIndex++) {
if (matrix[rowIndex][0] === 1) markNonIsland(matrix, rowIndex, 0);
if (matrix[rowIndex][lastColIndex] === 1)
markNonIsland(matrix, rowIndex, lastColIndex);
}
for (let rowIndex = 0; rowIndex < matrix.length; rowIndex++) {
for (let colIndex = 0; colIndex < matrix[rowIndex].length; colIndex++) {
if (matrix[rowIndex][colIndex] === 1) {
matrix[rowIndex][colIndex] = 0;
}
if (matrix[rowIndex][colIndex] === 2) {
matrix[rowIndex][colIndex] = 1;
}
}
}
return matrix;
}
================================================
FILE: coding_interviews/algoexpert/remove-islands/remove-islands.js
================================================
/**
You're given a two-dimensional array (a matrix) of potentially unequal height and width containing only 0s and 1s.
The matrix represents a two-toned image, where each 1 represents black and each 0 represents white.
An island is defined as any number of 1s that are horizontally or vertically adjacent (but not diagonally adjacent)
and that don't touch the border of the image. In other words, a group of horizontally or vertically adjacent 1s isn't an island
if any of those 1s are in the first row, last row, first column, or last column of the input matrix.
Note that an island can twist. In other words, it doesn't have to be a straight vertical line or a straight horizontal line;
it can be L-shaped, for example.
You can think of islands as patches of black that don't touch the border of the two-toned image.
Write a function that returns a modified version of the input matrix, where all of the islands are removed.
You remove an island by replacing it with 0s.
Naturally, you're allowed to mutate the input matrix.
*/
function removeIsland(matrix, rowIndex, colIndex) {
if (
rowIndex < 0 ||
rowIndex >= matrix.length ||
colIndex < 0 ||
colIndex >= matrix[rowIndex].length
) {
return;
}
if ([0, 2].includes(matrix[rowIndex][colIndex])) {
return;
}
matrix[rowIndex][colIndex] = 2;
removeIsland(matrix, rowIndex - 1, colIndex); // top
removeIsland(matrix, rowIndex + 1, colIndex); // bottom
removeIsland(matrix, rowIndex, colIndex - 1); // left
removeIsland(matrix, rowIndex, colIndex + 1); // right
}
function removeIslands(matrix) {
for (let rowIndex = 0; rowIndex < matrix.length; rowIndex++) {
for (let colIndex = 0; colIndex < matrix[rowIndex].length; colIndex++) {
if (
matrix[rowIndex][colIndex] === 1 &&
(rowIndex === 0 ||
rowIndex === matrix.length - 1 ||
colIndex === 0 ||
colIndex === matrix[rowIndex].length - 1)
) {
removeIsland(matrix, rowIndex, colIndex);
}
}
}
for (let rowIndex = 0; rowIndex < matrix.length; rowIndex++) {
for (let colIndex = 0; colIndex < matrix[rowIndex].length; colIndex++) {
if (matrix[rowIndex][colIndex] === 1) {
matrix[rowIndex][colIndex] = 0;
}
if (matrix[rowIndex][colIndex] === 2) {
matrix[rowIndex][colIndex] = 1;
}
}
}
return matrix;
}
================================================
FILE: coding_interviews/algoexpert/run-length-encoding/run-length-encoding copy.js
================================================
function runLengthEncoding(string) {
let currentChar;
let num = 1;
let result = [];
for (let index = 0; index < string.length; index++) {
currentChar = string[index];
if (currentChar === string[index + 1] && num < 9) {
num++;
} else {
result.push(`${num}${currentChar}`);
num = 1;
}
}
return result.join('');
}
================================================
FILE: coding_interviews/algoexpert/run-length-encoding/run-length-encoding-cleaner.js
================================================
function runLengthEncoding(string) {
if (string.length === 1) {
return `1${string}`;
}
let currentChar = string[0];
let num = 1;
let result = [];
for (let index = 1; index < string.length; index++) {
let char = string[index];
if (char === currentChar) {
if (num === 9) {
result.push(num);
result.push(currentChar);
num = 1;
} else {
num++;
}
} else {
result.push(num);
result.push(currentChar);
num = 1;
currentChar = char;
}
if (index === string.length - 1) {
result.push(num);
result.push(currentChar);
}
}
return result.join('');
}
================================================
FILE: coding_interviews/algoexpert/run-length-encoding/run-length-encoding.js
================================================
function runLengthEncoding(string) {
if (string.length === 1) {
return `1${string}`;
}
let currentChar = string[0];
let num = 1;
let result = [];
for (let index = 1; index < string.length; index++) {
let char = string[index];
if (char === currentChar) {
if (num === 9) {
result.push(num);
result.push(currentChar);
num = 1;
} else {
num++;
}
} else {
result.push(num);
result.push(currentChar);
num = 1;
currentChar = char;
}
if (index === string.length - 1) {
result.push(num);
result.push(currentChar);
}
}
return result.join('');
}
================================================
FILE: coding_interviews/algoexpert/semordnilap/semordnilap.js
================================================
/**
Write a function that takes in a list of unique strings
and returns a list of semordnilap pairs.
A semordnilap pair is defined as a set of different strings
where the reverse of one word is the same as the forward version
of the other. For example the words "diaper" and "repaid" are a
semordnilap pair, as are the words "palindromes" and "semordnilap".
The order of the returned pairs and the order of the strings
within each pair does not matter.
*/
// Runtime: O(N * M), N = number of words, M = length o largest word
// Space: O(N)
function reverse(word) {
let reversedWord = [];
for (let index = word.length - 1; index >= 0; index--) {
reversedWord.push(word[index]);
}
return reversedWord.join('');
}
function semordnilap(words) {
let pairs = [];
let map = new Map();
for (let word of words) {
if (map.has(word)) {
pairs.push([word, map.get(word)]);
} else {
map.set(reverse(word), word);
}
}
return pairs;
}
================================================
FILE: coding_interviews/algoexpert/smallest-difference/smallest-difference.js
================================================
/**
*
* Write a function that takes in two non-empty arrays of integers,
* finds the pair of numbers (one from each array) whose absolute
* difference is closest to zero, and returns an array containing
* these two numbers, with the number from the first array in the first position.
* Note that the absolute difference of two integers is the distance
* between them on the real number line. For example, the absolute
* difference of -5 and 5 is 10, and the absolute difference of -5 and -4 is 1.
* You can assume that there will only be one pair of numbers with the smallest difference.
*
* Input:
* arrayOne = [-1, 5, 10, 20, 28, 3]
* arrayTwo = [26, 134, 135, 15, 17]
*
* Output:
* [28, 26]
*/
// Runtime: O(NlogN + MlogM), where N = length of arrayOne and M = length of arrayTwo
// Space: O(1)
function smallestDifference(arrayOne, arrayTwo) {
let output = [];
let indexOne = 0;
let indexTwo = 0;
let smallestDistance = Infinity;
arrayOne.sort((a, b) => a - b);
arrayTwo.sort((a, b) => a - b);
while (indexOne < arrayOne.length && indexTwo < arrayTwo.length) {
let one = arrayOne[indexOne];
let two = arrayTwo[indexTwo];
let distance = Math.abs(one - two);
if (distance < smallestDistance) {
smallestDistance = distance;
output = [one, two];
}
if (one < two) indexOne++;
else indexTwo++;
}
return output;
}
================================================
FILE: coding_interviews/algoexpert/sorted-squared-array/sorted-squared-array-insert-position.js
================================================
// Runtime: O(n)
// Space: O(n)
function sortedSquaredArray(array) {
let output = [];
for (let num of array) {
let square = num * num;
let inserted = false;
for (let index = 0; index < output.length; index++) {
if (square <= output[index]) {
output = [...output.slice(0, index), square, ...output.slice(index)];
inserted = true;
break;
}
}
if (!inserted) output.push(square);
}
return output;
}
================================================
FILE: coding_interviews/algoexpert/sorted-squared-array/sorted-squared-array-two-pointers.js
================================================
// Runtime: O(n)
// Space: O(n)
function sortedSquaredArray(array) {
let p1 = 0;
let p2 = array.length - 1;
let result = [];
while (p1 <= p2) {
let square1 = array[p1] * array[p1];
let square2 = array[p2] * array[p2];
if (square1 > square2) {
result.unshift(square1);
p1++;
} else {
result.unshift(square2);
p2--;
}
}
return result;
}
================================================
FILE: coding_interviews/algoexpert/sorted-squared-array/sorted-squared-array.js
================================================
// Runtime: O(nlogn)
// Space: O(1)
function sortedSquaredArray(array) {
return array.map((num) => num * num).sort((a, b) => a - b);
}
================================================
FILE: coding_interviews/algoexpert/spiral-traverse/spiral-traverse.js
================================================
/**
*
* Write a function that takes in an n x m two-dimensional array (that can be square-shaped when n == m)
* and returns a one-dimensional array of all the array's elements in spiral order.
* Spiral order starts at the top left corner of the two-dimensional array, goes to the right,
* and proceeds in a spiral pattern all the way until every element has been visited.
*
* Input:
* array = [
* [1, 2, 3, 4],
* [12, 13, 14, 5],
* [11, 16, 15, 6],
* [10, 9, 8, 7],
* ]
*
* Output:
* [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
*/
// Right: keep the row and increase the column
// Bottom: keep the column and increase the row
// Left: keep the row and decrease the column
// Top: keep the column and decrease the row
function spiralTraverse(array) {
let row = 0;
let col = 0;
let endRow = array.length - 1;
let endCol = array[0].length - 1;
let output = [];
let command = 'R';
while (col <= endCol && row <= endRow) {
if (command === 'R') {
for (let index = col; index <= endCol; index++) {
output.push(array[row][index]);
}
row++;
command = 'B';
continue;
}
if (command === 'B') {
for (let index = row; index <= endRow; index++) {
output.push(array[index][endCol]);
}
endCol--;
command = 'L';
continue;
}
if (command === 'L') {
for (let index = endCol; index >= col; index--) {
output.push(array[endRow][index]);
}
endRow--;
command = 'T';
continue;
}
if (command === 'T') {
for (let index = endRow; index >= row; index--) {
output.push(array[index][col]);
}
col++;
command = 'R';
continue;
}
}
return output;
}
================================================
FILE: coding_interviews/algoexpert/tandem-bicycle/tandem-bicycle-cleaner.js
================================================
// Runtime: O(NlogN)
// Space: O(1)
function getTotalSpeed(redShirtSpeeds, blueShirtSpeeds) {
let sum = 0;
for (let index = 0; index < redShirtSpeeds.length; index++) {
sum += Math.max(redShirtSpeeds[index], blueShirtSpeeds[index]);
}
return sum;
}
function tandemBicycle(redShirtSpeeds, blueShirtSpeeds, fastest) {
redShirtSpeeds.sort((a, b) => a - b);
blueShirtSpeeds.sort((a, b) => (fastest ? b - a : a - b));
return getTotalSpeed(redShirtSpeeds, blueShirtSpeeds);
}
================================================
FILE: coding_interviews/algoexpert/tandem-bicycle/tandem-bicycle.js
================================================
// Runtime: O(NlogN)
// Space: O(1)
function getMinimumTotalSpeed(redShirtSpeeds, blueShirtSpeeds) {
let sum = 0;
for (let index = 0; index < redShirtSpeeds.length; index++) {
sum += Math.max(redShirtSpeeds[index], blueShirtSpeeds[index]);
}
return sum;
}
function getMaximumTotalSpeed(redShirtSpeeds, blueShirtSpeeds) {
let sum = 0;
for (let index = 0; index < redShirtSpeeds.length; index++) {
sum += Math.max(
redShirtSpeeds[index],
blueShirtSpeeds[blueShirtSpeeds.length - index - 1]
);
}
return sum;
}
function tandemBicycle(redShirtSpeeds, blueShirtSpeeds, fastest) {
redShirtSpeeds.sort((a, b) => a - b);
blueShirtSpeeds.sort((a, b) => a - b);
return fastest
? getMaximumTotalSpeed(redShirtSpeeds, blueShirtSpeeds)
: getMinimumTotalSpeed(redShirtSpeeds, blueShirtSpeeds);
}
================================================
FILE: coding_interviews/algoexpert/three-number-sum/three-number-sum.js
================================================
function sortKey(array) {
return [...new Set(array)]
.sort((a, b) => a - b)
.map((num) => num.toString())
.join('*');
}
function threeNumberSum(array, targetSum) {
array.sort((a, b) => a - b);
let map = new Map();
let triplets = [];
let cache = new Map();
for (let num of array) {
map.set(num, map.get(num) + 1 || 1);
}
for (let i = 0; i < array.length; i++) {
for (let j = i + 1; j < array.length; j++) {
let rest = targetSum - array[i] - array[j];
let triplet = [array[i], array[j], rest];
let sortedKey = sortKey(triplet);
let allEqual =
array[i] === array[j] &&
array[i] === rest &&
map.has(rest) &&
map.get(rest) >= 3;
let isFirstEqualRest =
array[i] !== array[j] &&
array[i] === rest &&
map.has(rest) &&
map.get(rest) >= 2;
let isSecondEqualRest =
array[i] !== array[j] &&
array[j] === rest &&
map.has(rest) &&
map.get(rest) >= 2;
let hasRest = array[i] !== rest && array[j] !== rest && map.has(rest);
let isEligibleTriplet =
(allEqual && isFirstEqualRest && isSecondEqualRest) || hasRest;
if (!cache.has(sortedKey) && isEligibleTriplet) {
cache.set(sortedKey, 1);
triplets.push(triplet);
}
}
}
return triplets;
}
================================================
FILE: coding_interviews/algoexpert/tournament-winner/tournament-winner-optimized.js
================================================
// Runtime: O(n), n being the number of competition
// Space: O(k), k being the number of teams
function tournamentWinner(competitions, results) {
let teams = new Map();
let maxPoints = 0;
let winner;
for (let index = 0; index < competitions.length; index++) {
let competition = competitions[index];
let result = results[index];
let team = result === 1 ? competition[0] : competition[1];
let points = (teams.get(team) || 0) + 3;
teams.set(team, points);
if (points > maxPoints) {
winner = team;
maxPoints = points;
}
}
return winner;
}
================================================
FILE: coding_interviews/algoexpert/tournament-winner/tournament-winner.js
================================================
// Runtime: O(n), n being the number of competition
// Space: O(k), k being the number of teams
function tournamentWinner(competitions, results) {
let teams = new Map();
let maxPoints = 0;
let winner;
for (let index = 0; index < competitions.length; index++) {
let competition = competitions[index];
let result = results[index];
let team = result === 1 ? competition[0] : competition[1];
teams.set(team, (teams.get(team) || 0) + 3);
}
for (let [team, points] of teams.entries()) {
if (points > maxPoints) {
winner = team;
maxPoints = points;
}
}
return winner;
}
================================================
FILE: coding_interviews/algoexpert/transpose-matrix/transpose-matrix.js
================================================
// Runtime: O(R * C), R = rows and C = columns
// Space: O(N)
function transposeMatrix(matrix) {
let transposedMatrix = [];
for (let col = 0; col < matrix[0].length; col++) {
let newRow = [];
for (let row = 0; row < matrix.length; row++) {
let cell = matrix[row][col];
newRow.push(cell);
}
transposedMatrix.push(newRow);
}
return transposedMatrix;
}
================================================
FILE: coding_interviews/algoexpert/two-number-sum/two-number-sum-optimized.js
================================================
// Runtime: O(n)
// Space: O(n)
function twoNumberSum(array, targetSum) {
let hashmap = new Map();
for (let num of array) {
let complement = targetSum - num;
if (hashmap.has(complement)) {
return [num, complement];
}
hashmap.set(num, num);
}
return [];
}
================================================
FILE: coding_interviews/algoexpert/two-number-sum/two-number-sum-two-pointers.js
================================================
// Runtime: O(nlogn)
// Space: O(1)
function twoNumberSum(array, targetSum) {
array.sort((a, b) => a - b);
let left = 0;
let right = array.length - 1;
while (left < right) {
let leftNumber = array[left];
let rightNumber = array[right];
if (leftNumber + rightNumber === targetSum) {
return [leftNumber, rightNumber];
}
if (leftNumber + rightNumber > targetSum) {
right--;
} else {
left++;
}
}
return [];
}
================================================
FILE: coding_interviews/algoexpert/two-number-sum/two-number-sum.js
================================================
// Runtime: O(n^2)
// Space: O(1)
function twoNumberSum(array, targetSum) {
let hashmap = new Map();
for (let num of array) {
hashmap.set(num, num);
}
for (let num of array) {
let match = targetSum - num;
if (match !== num && hashmap.has(match)) {
return [num, match];
}
}
return [];
}
================================================
FILE: coding_interviews/algoexpert/validate-bst/validate-bst.js
================================================
class BST {
constructor(value) {
this.value = value;
this.left = null;
this.right = null;
}
}
function validateBst(tree) {
if (!tree) return true;
let greaterThanLeftChild = true;
let smallerThanOrEqualToRightChild = true;
if (tree.left) greaterThanLeftChild = tree.left.value < tree.value;
if (tree.right)
smallerThanOrEqualToRightChild = tree.right.value >= tree.value;
return (
greaterThanLeftChild &&
smallerThanOrEqualToRightChild &&
validateBst(tree.left) &&
validateBst(tree.right)
);
}
================================================
FILE: coding_interviews/algoexpert/validate-subsequence/validate-subsequence-two-pointers.js
================================================
// Runtime: O(n)
// Space: O(1)
function isValidSubsequence(array, sequence) {
let p1 = 0;
let p2 = 0;
while (p1 < array.length && p2 < sequence.length) {
if (array[p1] === sequence[p2]) {
p1++;
p2++;
} else {
p1++;
}
}
return p2 === sequence.length;
}
================================================
FILE: coding_interviews/algoexpert/validate-subsequence/validate-subsequence.js
================================================
// Runtime: O(n)
// Space: O(1)
function isValidSubsequence(array, sequence) {
let p = 0;
for (let index = 0; index < array.length; index++) {
if (array[index] === sequence[p]) {
p++;
}
if (p === sequence.length) {
return true;
}
}
return false;
}
================================================
FILE: coding_interviews/algoexpert/zero-sum-subarray/zero-sum-subarray-optimized.js
================================================
// Runtime: O(N), N = nums length
// Space: O(N)
function zeroSumSubarray(nums) {
let currentSum = 0;
let sums = new Set();
for (let index = 0; index < nums.length; index++) {
currentSum += nums[index];
if (currentSum === 0 || sums.has(currentSum)) {
return true;
}
sums.add(currentSum);
}
return false;
}
================================================
FILE: coding_interviews/algoexpert/zero-sum-subarray/zero-sum-subarray.js
================================================
// Runtime: O(N^2), N = nums length
// Space: O(1)
function zeroSumSubarray(nums) {
for (let i = 0; i < nums.length; i++) {
let sum = nums[i];
for (let j = i; j < nums.length; j++) {
if (i !== j) {
sum += nums[j];
}
if (sum === 0) {
return true;
}
}
}
return false;
}
================================================
FILE: coding_interviews/algorithms_in_python/queue/R-6.7.py
================================================
# What values are returned during the following sequence of queue operations,
# if executed on an initially empty queue? enqueue(5), enqueue(3), dequeue(),
# enqueue(2), enqueue(8), dequeue(), dequeue(), enqueue(9), enqueue(1), dequeue(),
# enqueue(7), enqueue(6), dequeue(), dequeue(), enqueue(4), dequeue(), dequeue().
class Emptiness(Exception):
pass
class Queue:
def __init__(self):
self.items = []
def enqueue(self, item):
self.items.append(item)
def dequeue(self):
if self.is_empty():
raise Emptiness('The Queue is empty')
return self.items.pop(0)
def is_empty(self):
return self.size() == 0
def front(self):
if self.is_empty():
raise Emptiness('The Queue is empty')
return self.items[0]
def back(self):
if self.is_empty():
raise Emptiness('The Queue is empty')
return self.items[-1]
def size(self):
return len(self.items)
queue = Queue()
queue.enqueue(5) # [5]
queue.enqueue(3) # [5, 3]
queue.dequeue() # [3]
queue.enqueue(2) # [3, 2]
queue.enqueue(8) # [3, 2, 8]
queue.dequeue() # [2, 8]
queue.dequeue() # [8]
queue.enqueue(9) # [8, 9]
queue.enqueue(1) # [8, 9, 1]
queue.dequeue() # [9, 1]
queue.enqueue(7) # [9, 1, 7]
queue.enqueue(6) # [9, 1, 7, 6]
queue.dequeue() # [1, 7, 6]
queue.dequeue() # [7, 6]
queue.enqueue(4) # [7, 6, 4]
queue.dequeue() # [6, 4]
queue.dequeue() # [4]
================================================
FILE: coding_interviews/algorithms_in_python/stack/R-6.1.py
================================================
# R-6.1 from the Algorithms in Pytho book
# What values are returned during the following series of stack operations,
# if executed upon an initially empty stack?
# push(5), push(3), pop(), push(2), push(8), pop(), pop(), push(9),
# push(1), pop(), push(7), push(6), pop(), pop(), push(4), pop(), pop().
class Emptiness(Exception):
pass
class Stack:
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
if self.is_empty():
raise Emptiness('The Stack is empty')
return self.items.pop()
def is_empty(self):
return self.size() == 0
def top(self):
if self.is_empty():
raise Emptiness('The Stack is empty')
return self.items[-1]
def size(self):
return len(self.items)
stack = Stack()
stack.push(5) # [5]
stack.push(3) # [5, 3]
stack.pop() # [5] (removed 3)
stack.push(2) # [5, 2]
stack.push(8) # [5, 2, 8]
stack.pop() # [5, 2] (removed 8)
stack.pop() # [5] (removed 2)
stack.push(9) # [5, 9]
stack.push(1) # [5, 9, 1]
stack.pop() # [5, 9] (removed 1)
stack.push(7) # [5, 9, 7]
stack.push(6) # [5, 9, 7, 6]
stack.pop() # [5, 9, 7] (removed 6)
stack.pop() # [5, 9] (removed 7)
stack.push(4) # [5, 9, 4]
stack.pop() # [5, 9] (removed 4)
stack.pop() # [5] (removed 9)
================================================
FILE: coding_interviews/algorithms_in_python/stack/R-6.3.py
================================================
# R-6.3 from the Algorithms in Pytho book
# Implement a function with signature transfer(S, T) that transfers all elements
# from stack S onto stack T, so that the element that starts at the top of S is
# the first to be inserted onto T, and the element at the bottom of S ends up at the top of T.
class Emptiness(Exception):
pass
class Stack:
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
if self.is_empty():
raise Emptiness('The Stack is empty')
return self.items.pop()
def is_empty(self):
return self.size() == 0
def top(self):
if self.is_empty():
raise Emptiness('The Stack is empty')
return self.items[-1]
def size(self):
return len(self.items)
def transfer(S, T):
while not S.is_empty():
popped_item = S.pop()
T.push(popped_item)
return T
S = Stack()
T = Stack()
S.push(1)
S.push(2)
S.push(3)
S.push(4)
S.push(5)
new_T = transfer(S, T)
print(new_T.items) # [5, 4, 3, 2, 1]
================================================
FILE: coding_interviews/algorithms_in_python/stack/R-6.4.py
================================================
# R-6.4 from the Algorithms in Pytho book
# Give a recursive method for removing all the elements from a stack.
class Emptiness(Exception):
pass
class Stack:
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
if self.is_empty():
raise Emptiness('The Stack is empty')
return self.items.pop()
def is_empty(self):
return self.size() == 0
def top(self):
if self.is_empty():
raise Emptiness('The Stack is empty')
return self.items[-1]
def size(self):
return len(self.items)
def remove_all(stack):
if stack.is_empty():
return stack
stack.pop()
return remove_all(stack)
stack = Stack()
stack.push(1)
stack.push(2)
stack.push(3)
stack.push(4)
stack.push(5)
new_stack = remove_all(stack)
print(new_stack.items) # []
================================================
FILE: coding_interviews/algorithms_in_python/stack/R-6.5.py
================================================
# R-6.5 from the Algorithms in Pytho book
# Implement a function that reverses a list of elements by pushing them onto
# a stack in one order, and writing them back to the list in reversed order.
class Emptiness(Exception):
pass
class Stack:
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
if self.is_empty():
raise Emptiness('The Stack is empty')
return self.items.pop()
def is_empty(self):
return self.size() == 0
def top(self):
if self.is_empty():
raise Emptiness('The Stack is empty')
return self.items[-1]
def size(self):
return len(self.items)
def reverse(items):
stack = Stack()
for item in items:
stack.push(item)
new_items = []
while not stack.is_empty():
popped_item = stack.pop()
new_items.append(popped_item)
return new_items
items = [1, 2, 3, 4, 5]
new_items = reverse(items)
print(new_items)
================================================
FILE: coding_interviews/blind75/README.md
================================================
<samp>
# Blind 75 LeetCode Questions
## Array
- [x] [Two Sum](https://leetcode.com/problems/two-sum): [Solution](/coding_interviews/leetcode/easy/two-sum/two-sum.js)
- [ ] [Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock)
- [x] [Contains Duplicate](https://leetcode.com/problems/contains-duplicate): [Solution 1](/coding_interviews/leetcode/easy/contains-duplicate/contains-duplicate.js) & [Solution 2](/coding_interviews/leetcode/easy/contains-duplicate/contains-duplicate-hashmap.js)
- [x] [Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self): [Solution](/coding_interviews/leetcode/medium/product-of-array-except-self/product-of-array-except-self.js)
- [x] [Maximum Subarray](https://leetcode.com/problems/maximum-subarray): [Solution](/coding_interviews/leetcode/easy/maximum-subarray/maximum-subarray.js)
- [ ] [Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray)
- [ ] [Find Minimum in Rotated Sorted Array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array)
- [ ] [Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array)
- [ ] [3Sum](https://leetcode.com/problems/3sum)
- [ ] [Container With Most Water](https://leetcode.com/problems/container-with-most-water)
## Binary
- [ ] [Sum of Two Integers](https://leetcode.com/problems/sum-of-two-integers)
- [ ] [Number of 1 Bits](https://leetcode.com/problems/number-of-1-bits)
- [ ] [Counting Bits](https://leetcode.com/problems/counting-bits)
- [ ] [Missing Number](https://leetcode.com/problems/missing-number)
- [ ] [Reverse Bits](https://leetcode.com/problems/reverse-bits)
## Dynamic Programming
- [x] [Climbing Stairs](https://leetcode.com/problems/climbing-stairs): [Solution](/coding_interviews/leetcode/easy/climbing-stairs/climbing-stairs.js)
- [ ] [Coin Change](https://leetcode.com/problems/coin-change)
- [ ] [Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence)
- [ ] [Longest Common Subsequence](https://leetcode.com/problems/longest-common-subsequence)
- [ ] [Word Break Problem](https://leetcode.com/problems/word-break)
- [ ] [Combination Sum](https://leetcode.com/problems/combination-sum-iv)
- [ ] [House Robber](https://leetcode.com/problems/house-robber)
- [ ] [House Robber II](https://leetcode.com/problems/house-robber-ii)
- [ ] [Decode Ways](https://leetcode.com/problems/decode-ways)
- [ ] [Unique Paths](https://leetcode.com/problems/unique-paths)
- [ ] [Jump Game](https://leetcode.com/problems/jump-game)
## Graph
- [x] [Clone Graph](https://leetcode.com/problems/clone-graph): [Solution](https://github.com/imteekay/algorithms/blob/master/coding_interviews/leetcode/medium/clone-graph/clone-graph.js)
- [ ] [Course Schedule](https://leetcode.com/problems/course-schedule)
- [ ] [Pacific Atlantic Water Flow](https://leetcode.com/problems/pacific-atlantic-water-flow)
- [x] [Number of Islands](https://leetcode.com/problems/number-of-islands): [Solution](/coding_interviews/leetcode/medium/number-of-islands/number-of-islands.js)
- [ ] [Longest Consecutive Sequence](https://leetcode.com/problems/longest-consecutive-sequence)
## Interval
- [ ] [Insert Interval](https://leetcode.com/problems/insert-interval)
- [ ] [Merge Intervals](https://leetcode.com/problems/merge-intervals)
- [ ] [Non-overlapping Intervals](https://leetcode.com/problems/non-overlapping-intervals)
## Linked List
- [x] [Reverse a Linked List](https://leetcode.com/problems/reverse-linked-list): [Solution](/coding_interviews/leetcode/easy/reverse-linked-list/reverse-linked-list.js)
- [ ] [Detect Cycle in a Linked List](https://leetcode.com/problems/linked-list-cycle)
- [ ] [Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists): [Solution](/coding_interviews/leetcode/easy/merge-two-sorted-lists/merge-two-sorted-lists.js)
- [ ] [Merge K Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists)
- [ ] [Remove Nth Node From End Of List](https://leetcode.com/problems/remove-nth-node-from-end-of-list): [Solution 1](/coding_interviews/leetcode/medium/remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.js) & [Solution 2](/coding_interviews/leetcode/medium/remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list-fast-slow.js)
- [ ] [Reorder List](https://leetcode.com/problems/reorder-list)
## Matrix
- [x] [Set Matrix Zeroes](https://leetcode.com/problems/set-matrix-zeroes): [Solution](/coding_interviews/leetcode/medium/set-matrix-zeroes/set-matrix-zeroes.js)
- [ ] [Spiral Matrix](https://leetcode.com/problems/spiral-matrix)
- [x] [Rotate Image](https://leetcode.com/problems/rotate-image): [Solution](/coding_interviews/leetcode/medium/rotate-image/rotate-image.js)
- [ ] [Word Search](https://leetcode.com/problems/word-search)
## String
- [x] [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters): [Solution](/coding_interviews/leetcode/medium/longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.js)
- [ ] [Longest Repeating Character Replacement](https://leetcode.com/problems/longest-repeating-character-replacement)
- [ ] [Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring)
- [x] [Valid Anagram](https://leetcode.com/problems/valid-anagram): [Solution](/coding_interviews/leetcode/easy/valid-anagram/valid-anagram.js)
- [x] [Group Anagrams](https://leetcode.com/problems/group-anagrams): [Solution](/coding_interviews/leetcode/medium/group-anagrams/group-anagrams.js)
- [x] [Valid Parentheses](https://leetcode.com/problems/valid-parentheses): [Solution](/coding_interviews/leetcode/easy/valid-parentheses/valid-parentheses.js)
- [x] [Valid Palindrome](https://leetcode.com/problems/valid-palindrome): [Solution](/coding_interviews/leetcode/easy/valid-palindrome/valid-palindrome.js)
- [ ] [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring)
- [ ] [Palindromic Substrings](https://leetcode.com/problems/palindromic-substrings)
## Tree
- [x] [Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree): [Solution 1](/coding_interviews/leetcode/easy/maximum-depth-of-binary-tree/maximum-depth-of-binary-tree.js) & [Solution 2](/coding_interviews/leetcode/easy/maximum-depth-of-binary-tree/maximum-depth-of-binary-tree-2.js)
- [x] [Same Tree](https://leetcode.com/problems/same-tree): [Solution](/coding_interviews/leetcode/easy/same-tree/same-tree.js)
- [x] [Invert/Flip Binary Tree](https://leetcode.com/problems/invert-binary-tree): [Solution](/coding_interviews/leetcode/easy/invert-binary-tree/invert-binary-tree.js)
- [ ] [Binary Tree Maximum Path Sum](https://leetcode.com/problems/binary-tree-maximum-path-sum)
- [x] [Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal): [Solution](/coding_interviews/leetcode/medium/binary-tree-level-order-traversal/binary-tree-level-order-traversal.js)
- [ ] [Serialize and Deserialize Binary Tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree)
- [x] [Subtree of Another Tree](https://leetcode.com/problems/subtree-of-another-tree): [Solution](/coding_interviews/leetcode/easy/subtree-of-another-tree/subtree-of-another-tree.js)
- [ ] [Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal)
- [x] [Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree): [Solution 1](/coding_interviews/leetcode/medium/validate-binary-search-tree/validate-binary-search-tree-2.js) & [Solution 2](/coding_interviews/leetcode/medium/validate-binary-search-tree/validate-binary-search-tree.js)
- [x] [Kth Smallest Element in a BST](https://leetcode.com/problems/kth-smallest-element-in-a-bst): [Solution 1](/coding_interviews/leetcode/medium/kth-smallest-element-in-a-bst/kth-smallest-element-in-a-bst-1.js) & [Solution 2](/coding_interviews/leetcode/medium/kth-smallest-element-in-a-bst/kth-smallest-element-in-a-bst-2.js)
- [x] [Lowest Common Ancestor of BST](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree): [Solution](/coding_interviews/leetcode/easy/lowest-common-ancestor-of-a-binary-search-tree/lowest-common-ancestor-of-a-binary-search-tree.js)
- [ ] [Implement Trie (Prefix Tree)](https://leetcode.com/problems/implement-trie-prefix-tree)
- [ ] [Add and Search Word](https://leetcode.com/problems/add-and-search-word-data-structure-design)
- [ ] [Word Search II](https://leetcode.com/problems/word-search-ii)
## Heap
- [ ] [Merge K Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists)
- [ ] [Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements)
- [ ] [Find Median from Data Stream](https://leetcode.com/problems/find-median-from-data-stream)
## Important Link:
[14 Patterns to Ace Any Coding Interview Question](https://hackernoon.com/14-patterns-to-ace-any-coding-interview-question-c5bb3357f6ed)
</samp>
================================================
FILE: coding_interviews/coding_interview_questions/common_elements.py
================================================
def common_elements(list1, list2):
result = []
elements = {}
for item in list1:
elements[item] = 1
for item in list2:
if item in elements:
result.append(item)
return result
# common_elements(list_a1, list_a2) should return [1, 4, 9] (a list).
list_a1 = [1, 3, 4, 6, 7, 9]
list_a2 = [1, 2, 4, 5, 9, 10]
print(common_elements(list_a1, list_a2))
# common_elements(list_b1, list_b2) should return [1, 2, 9, 10, 12] (a list).
list_b1 = [1, 2, 9, 10, 11, 12]
list_b2 = [0, 1, 2, 3, 4, 5, 8, 9, 10, 12, 14, 15]
print(common_elements(list_b1, list_b2))
# common_elements(list_b1, list_b2) should return [] (an empty list).
list_c1 = [0, 1, 2, 3, 4, 5]
list_c2 = [6, 7, 8, 9, 10, 11]
print(common_elements(list_c1, list_c2))
================================================
FILE: coding_interviews/coding_interview_questions/decode-string/decode-string.js
================================================
const isNum = (char) => !isNaN(Number(char));
export function decodeString(encodedString) {
const stack = [];
let index = 0;
while (index < encodedString.length) {
const char = encodedString[index];
if (isNum(char)) {
const number = [];
while (isNum(encodedString[index])) {
number.push(encodedString[index]);
index++;
}
stack.push(Number(number.join('')));
continue;
}
if (char === ']') {
let str = '';
while (stack[stack.length - 1] !== '[') {
str = stack.pop() + str;
}
stack.pop();
stack.push(str.repeat(stack.pop()));
index++;
continue;
}
stack.push(char);
index++;
}
return stack.join('');
}
================================================
FILE: coding_interviews/coding_interview_questions/decode-string/tests/decode-string.test.js
================================================
import { describe, it, expect } from 'vitest';
import { decodeString } from '../decode-string';
describe('decodeString', () => {
it('', () => {
expect(decodeString('3[a]2[bc]')).toEqual('aaabcbc');
});
it('', () => {
expect(decodeString('2[abc]3[cd]ef')).toEqual('abcabccdcdcdef');
});
it('', () => {
expect(decodeString('3[a2[c]]')).toEqual('accaccacc');
});
it('', () => {
expect(decodeString('100[leetcode]')).toEqual(
'leetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcodeleetcode'
);
});
});
================================================
FILE: coding_interviews/coding_interview_questions/mine_swipper.py
================================================
# [[0, 0], [0, 1]], 3, 4
# => [
# [-1, -1, 1, 0],
# [2, 2, 1, 0],
# [0, 0, 0, 0]
# ]
def update_table_spot(table, row, col, num_rows, num_cols):
table_with_border = table
border = []
for row in range(num_rows):
table_with_border[row].insert(0, 0)
table_with_border[row].insert(num_cols+1, 0)
for i in range(num_cols+2):
border.append(0)
table_with_border.insert(0, border)
table_with_border.insert(num_rows+1, border)
number_of_bomb_neighboors = 0
for i in range(num_rows):
for j in range(num_cols):
print(table[i][j], end='')
print()
print()
if table_with_border[row-1][col-1] == -1: number_of_bomb_neighboors += 1
if table_with_border[row-1][col] == -1: number_of_bomb_neighboors += 1
if table_with_border[row-1][col+1] == -1: number_of_bomb_neighboors += 1
if table_with_border[row][col-1] == -1: number_of_bomb_neighboors += 1
if table_with_border[row][col+1] == -1: number_of_bomb_neighboors += 1
if table_with_border[row+1][col-1] == -1: number_of_bomb_neighboors += 1
if table_with_border[row+1][col] == -1: number_of_bomb_neighboors += 1
if table_with_border[row+1][col+1] == -1: number_of_bomb_neighboors += 1
table[row][col] = number_of_bomb_neighboors
return table
def mine_swipper(bombs, num_rows, num_cols):
table = []
for row in range(num_rows):
filled_row = []
for col in range(num_cols):
filled_row.append(0)
table.append(filled_row)
for bomb in bombs:
table[bomb[0]][bomb[1]] = -1
for row in range(num_rows):
for col in range(num_cols):
if table[row][col] == 0:
table = update_table_spot(table, row, col, num_rows, num_cols)
for i in range(num_rows):
for j in range(num_cols):
print(table[i][j], end='')
print()
mine_swipper([[0, 0], [0, 1]], 3, 4)
================================================
FILE: coding_interviews/coding_interview_questions/most_frequently_occurring.py
================================================
def most_frequent(given_list):
max_item = 0
result = 0
if not given_list:
return None
frequencies = {}
for item in given_list:
if item in frequencies:
frequencies[item] += 1
else:
frequencies[item] = 1
if frequencies[item] > max_item:
result = item
max_item = frequencies[item]
return result
# most_frequent(list1) should return 1
list1 = [1, 3, 1, 3, 2, 1]
print(most_frequent(list1))
# most_frequent(list2) should return 3
list2 = [3, 3, 1, 3, 2, 1]
print(most_frequent(list2))
# most_frequent(list3) should return None
list3 = []
print(most_frequent(list3))
# most_frequent(list4) should return 0
list4 = [0]
print(most_frequent(list4))
# most_frequent(list5) should return -1
list5 = [0, -1, 10, 10, -1, 10, -1, -1, -1, 1]
print(most_frequent(list5))
================================================
FILE: coding_interviews/coding_interview_questions/non_repeating.py
================================================
# 'aabcb' --> 'c'
# 'xxyz' --> 'y'
# '' --> None
# 'aabb' --> None
# 'abcab' --> 'c'
# 'abab' --> None
# 'aabbbc' --> 'c'
# 'aabbdbc' --> 'd'
def non_repeating(string):
counter_mapping = {}
for char in string:
if char in counter_mapping:
counter_mapping[char] += 1
else:
counter_mapping[char] = 1
for char, counter in counter_mapping.items():
if counter == 1:
return char
return None
print(non_repeating('aabcb'))
print(non_repeating('xxyz'))
print(non_repeating(''))
print(non_repeating('aabb'))
print(non_repeating("abcab"))
print(non_repeating("abab"))
print(non_repeating("aabbbc"))
print(non_repeating("aabbdbc"))
================================================
FILE: coding_interviews/coding_interview_questions/nth_element_from_the_end.py
================================================
# Use this class to create linked lists.
class Node:
def __init__(self, value, next=None):
self.value = value
self.next = next
def __str__(self):
return str(self.value)
def nth_from_last(head, n):
if head is None or n < 0:
return
elements = []
current_node = head
while current_node:
elements.append(current_node.value)
current_node = current_node.next
if n > len(elements):
return None
else:
return elements[len(elements) - n]
# Testing Linked List function
def linked_list_to_string(head):
current = head
str_list = []
while current:
str_list.append(str(current.value))
current = current.next
return ' -> '.join(str_list.append('(None)'))
current = Node(1)
for i in range(2, 8):
current = Node(i, current)
head = current
# head = 7 -> 6 -> 5 -> 4 -> 3 -> 2 -> 1 -> (None)
current2 = Node(4)
for i in range(3, 0, -1):
current2 = Node(i, current2)
head2 = current2
# head2 = 1 -> 2 -> 3 -> 4 -> (None)
print('nth_from_last(head, 1) should return 1.')
print(nth_from_last(head, 1))
print('nth_from_last(head, 5) should return 5.')
print(nth_from_last(head, 5))
print('nth_from_last(head2, 2) should return 3.')
print(nth_from_last(head2, 2))
print('nth_from_last(head2, 4) should return 1.')
print(nth_from_last(head2, 4))
print('nth_from_last(head2, 5) should return None.')
print(nth_from_last(head2, 5))
print('nth_from_last(None, 1) should return None.')
print(nth_from_last(None, 1))
================================================
FILE: coding_interviews/coding_interview_questions/one_away_strings.py
================================================
# 'abcde'
# 'abfde'
# => True
# 'abcde'
# 'abde'
# => True
# 'abde'
# 'abfde'
# => True
def handle_different_sized_strings(s1, s2):
indice1, indice2, number_of_differences = 0, 0, 0
while indice2 < len(s2):
if number_of_differences > 1:
return False
if s1[indice1] != s2[indice2]:
number_of_differences += 1
indice1 += 1
indice1 += 1
indice2 += 1
return True
def handle_same_sized_strings(s1, s2):
number_of_differences = 0
for indice in range(len(s1)):
if s1[indice] != s2[indice]:
number_of_differences += 1
return number_of_differences == 1
def is_one_away(s1, s2):
if len(s1) - len(s2) > 1 or len(s2) - len(s1) > 1:
return False
if s1 == s2:
return True
if len(s1) > len(s2):
return handle_different_sized_strings(s1, s2)
if len(s2) > len(s1):
return handle_different_sized_strings(s2, s1)
if len(s1) == len(s2):
return handle_same_sized_strings(s1, s2)
print(is_one_away('abcde', 'abfde'))
print(is_one_away('abcde', 'abde'))
print(is_one_away('abde', 'abfde'))
print(is_one_away('', ''))
print(is_one_away('', 'a'))
print(is_one_away('a', ''))
print(is_one_away('aabb', 'aacc'))
print()
print(is_one_away("abcde", "abcd")) # should return True
print(is_one_away("abde", "abcde")) # should return True
print(is_one_away("a", "a")) # should return True
print(is_one_away("abcdef", "abqdef")) # should return True
print(is_one_away("abcdef", "abccef")) # should return True
print(is_one_away("abcdef", "abcde")) # should return True
print(is_one_away("aaa", "abc")) # should return False
print(is_one_away("abcde", "abc")) # should return False
print(is_one_away("abc", "abcde")) # should return False
print(is_one_away("abc", "bcc")) # should return False
================================================
FILE: coding_interviews/coding_interview_questions/optimized_common_elements.py
================================================
def common_elements(list1, list2):
result = []
point1 = 0
point2 = 0
while point1 < len(list1) and point2 < len(list2):
if list1[point1] == list2[point2]:
result.append(list1[point1])
point1 += 1
point2 += 1
elif list1[point1] > list2[point2]:
point2 += 1
else:
point1 += 1
return result
# common_elements(list_a1, list_a2) should return [1, 4, 9] (a list).
list_a1 = [1, 3, 4, 6, 7, 9]
list_a2 = [1, 2, 4, 5, 9, 10]
print(common_elements(list_a1, list_a2))
# common_elements(list_b1, list_b2) should return [1, 2, 9, 10, 12] (a list).
list_b1 = [1, 2, 9, 10, 11, 12]
list_b2 = [0, 1, 2, 3, 4, 5, 8, 9, 10, 12, 14, 15]
print(common_elements(list_b1, list_b2))
# common_elements(list_b1, list_b2) should return [] (an empty list).
list_c1 = [0, 1, 2, 3, 4, 5]
list_c2 = [6, 7, 8, 9, 10, 11]
print(common_elements(list_c1, list_c2))
================================================
FILE: coding_interviews/coding_interview_questions/rotation_array.py
================================================
# both arrays are the same size? => true
# is A and B is equal, is A a rotation of B? => false
# is both array is empty, one is a rotation of another? => true
# [1, 2, 3, 4, 5, 6, 7]
# [4, 5, 6, 7, 1, 2, 3]
# True
# [1, 2, 3, 4, 5, 6, 7]
# [4, 3, 6, 7, 1, 2, 3]
# False
# []
# []
# True
def is_rotation(a, b):
if a == b:
return True
if len(a) != len(b):
return False
for index in range(1, len(b)):
if b[index:len(b)] + b[0:index] == a:
return True
return False
a = [1, 2, 3, 4, 5, 6, 7]
b = [4, 5, 6, 7, 1, 2, 3]
print(is_rotation(a, b))
a = [1, 2, 3, 4, 5, 6, 7]
b = [4, 3, 6, 7, 1, 2, 3]
print(is_rotation(a, b))
a = []
b = []
print(is_rotation(a, b))
================================================
FILE: coding_interviews/coding_interview_questions/two-crystal-balls/index.js
================================================
export function twoCrystalBalls(breaks) {
let jumpAmount = Math.floor(Math.sqrt(breaks.length));
let index = jumpAmount;
for (; index < breaks.length; index += jumpAmount) {
if (breaks[index]) break;
}
index -= jumpAmount;
for (let j = 0; j < jumpAmount && index < breaks.length; index++, j++) {
if (breaks[index]) return index;
}
return -1;
}
================================================
FILE: coding_interviews/coding_interview_questions/two-crystal-balls/tests/index.test.js
================================================
import { describe, expect, it } from 'vitest';
import { twoCrystalBalls } from '..';
describe('twoCrystalBalls', () => {
it('', () => {
const idx = Math.floor(Math.random() * 10000);
const data = new Array(10000).fill(false);
for (let i = idx; i < 10000; ++i) {
data[i] = true;
}
expect(twoCrystalBalls(data)).toEqual(idx);
expect(twoCrystalBalls(new Array(821).fill(false))).toEqual(-1);
});
});
================================================
FILE: coding_interviews/cracking-the-coding-interview/README.md
================================================
# Cracking the Coding Interview
## Chapter 001: Arrays and Strings
- [1.1 Is Unique](./chapter-001/is-unique)
- [1.2 Check Permutation](./chapter-001/check-permutation)
- [1.3 URLlify](./chapter-001/urlify)
- [1.4 Palindrome Permutation](./chapter-001/palindrome-permutation)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/aditional1.py
================================================
def product(a, b):
sum = 0
for i in range(b):
sum += a
return sum
print(product(2, 4))
# Complexity: O(b) | O(N)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/aditional2.py
================================================
def power(a, b):
if b < 0:
return 0
elif b == 0:
return 1
else:
return a * power(a, b - 1)
print(power(2, 2))
print(power(2, 10))
print(power(3, 2))
# Complexity: O(B)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/aditional3.py
================================================
def mod(a, b):
if b > a:
return a
return mod(a - b, b)
print(mod(10, 2))
print(mod(10, 3))
print(mod(10, 4))
print(mod(10, 5))
print(mod(10, 6))
# Complexity: O(a / b)
def mod(a, b):
if b <= 0:
return -1
div = a / b
return a - div * b
# Complexity: O(1)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/aditional4.py
================================================
def div(a, b):
count = 0
sum = b
while sum <= a:
sum += b
count += 1
return count
print(div(10, 5))
print(div(10, 2))
print(div(10, 3))
print(div(10, 11))
# Complexity: O(a / b)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/aditional5.py
================================================
def sqrt(n):
return sqrt_helper(n, 1, n)
def sqrt_helper(n, min, max):
if min > max:
return -1
guess = (min + max) / 2
if guess * guess > n:
return sqrt_helper(n, min, guess - 1)
elif guess * guess < n:
return sqrt_helper(n, guess + 1, max)
else:
return guess
print(sqrt(100))
print(sqrt(9))
print(sqrt(25))
print(sqrt(3))
# Complexity: O(log N) --> It is a binary search algorithm
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/aditional6.py
================================================
from math import sqrt
def square_root(n):
for guess in range(int(sqrt(n))+1):
if guess * guess == n:
return guess
return -1
print(square_root(100))
print(square_root(9))
print(square_root(25))
print(square_root(3))
# Complexity: O(log N) --> It is a binary search algorithm
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example1.py
================================================
def foo(array):
sum = 0
product = 1
for element in array:
sum += element
for element in array:
product *= element
print("%d, %d" %(sum, product))
foo([1, 2, 3, 4, 5])
# The complexity of the foo function is: O(N)
# Initializing sum and product = 1 + 1 = 2
# We iterate through the array two times = 2 * length(array) = 2 * N
# Printing sum and product = 1
# Conclusion: O(2N + 3) = O(N)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example10.py
================================================
from math import sqrt
def is_prime(num):
if num < 2:
return False
if num == 2:
return True
if num % 2 == 0:
return False
for i in range(3, int(sqrt(num)) + 1, 2):
if num % i == 0:
return False
return True
print(is_prime(1)) # False
print(is_prime(2)) # True
print(is_prime(9)) # False
print(is_prime(17)) # True
print(is_prime(24)) # False
# is prime function has complexity of O(sqrt(N))
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example11.py
================================================
def factorial(n):
if n < 0:
return -1
if n == 0:
return 1
return n * factorial(n - 1)
# factorial function has a complexity of O(N)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example12.py
================================================
def permutation(str):
handle_permutation(str, "")
def handle_permutation(str, prefix):
if len(str) == 0:
print(prefix)
else:
for i in range(len(str)):
rem = str[0:i] + str[i+1:]
handle_permutation(rem, prefix + str[i])
permutation('abc')
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example13.py
================================================
def fib(n):
if n == 0:
return 0
if n == 1:
return 1
return fib(n - 1) + fib(n - 2)
print(fib(1))
print(fib(4))
print(fib(5))
print(fib(10))
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example14.py
================================================
def all_fib(n):
for i in range(n):
print(fib(i))
def fib(n):
if n == 0:
return 0
if n == 1:
return 1
return fib(n - 1) + fib(n - 2)
all_fib(10)
# Complexity: O(2 ^ (n+1))
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example15.py
================================================
def all_fib(n):
memo = []
memo.append(0)
memo.append(1)
for i in range(n):
print("%d: %d" %(i, fib(i, memo)))
def fib(n, memo):
if n <= len(memo) - 1:
return memo[n]
memo.append(fib(n - 1, memo) + fib(n - 2, memo))
return memo[n]
all_fib(7)
# Complexity: O(N)
# All previous actions are already computed
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example16.py
================================================
def powers_of_2(n):
if n <= 0:
return 0
if n == 1:
print(1)
return 1
previous = powers_of_2(n / 2)
current = previous * 2
print(current)
return current
powers_of_2(4)
# Complexity: O(log N)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example2.py
================================================
def print_pairs(array):
for i in array:
for j in array:
print("%d, %d" %(i, j))
print_pairs([1, 2, 3, 4, 5])
# The complexity of the print_pairs function is: O(N^2)
# We do a nested loop = length(array) ^ 2 = N * 2
# There are O(N^2) pairs
# Conclusion: O(N^2)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example3.py
================================================
def print_unordered_pairs(array):
for i in range(len(array)):
for j in range(i+1, len(array)):
print("%d, %d" %(array[i], array[j]))
print_unordered_pairs([1, 2, 3, 4, 5])
# The complexity of the print_unordered_pairs function is: O(N^2)
# We do a nested loop = length(array) * (length(array) - 1) / 2 = (length(array) * 2 - length(array)) / 2 = (N^2 - N) / 2
# There are O((N^2 - N) / 2) pairs
# Conclusion: O(N^2)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example4.py
================================================
def print_unordered_pairs(array_a, array_b):
for a in array_a:
for b in array_b:
if a < b:
print('%d, %d' %(a, b))
print_unordered_pairs([1, 2, 3, 4, 5], [3, 1, 2, 5, 4])
# The complexity of the print_unordered_pairs function is: O(N^2)
# We do a nested loop = length(array_a) * length(array_b) = N^2
# There are O(N^2) pairs
# Conclusion: O(N^2)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example5.py
================================================
def print_unordered_pairs(array_a, array_b):
for a in array_a:
for b in array_b:
for i in range(1000000):
print('%d, %d' %(a, b))
print_unordered_pairs([1, 2, 3, 4, 5], [3, 1, 2, 5, 4])
# The complexity of the print_unordered_pairs function is: O(N^2)
# We do a nested loop = length(array_a) * length(array_b) * 1000000 = N^2 * 1000000
# There are O(N^2 * 1000000) pairs
# Conclusion: O(N^2)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example6.py
================================================
def reverse(array):
for i in range(len(array) / 2):
index = len(array) - i - 1
temporary_num = array[index]
array[index] = array[i]
array[i] = temporary_num
return array
new_array = reverse(list(range(1, 6))
for i in new_array:
print(i)
# The complexity of the reverse function is: O(N)
# Even though we iterate only through half of the array (O(N/2)), we still consider this a O(N) complexity
# Conclusion: O(N)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example7.py
================================================
# O(N + P), if P < N / 2 --> O(N)
# O(2N) --> O(N)
# O(N + logN) --> O(N)
# O(N + M), if N > M then O(N), otherwise O(M)
================================================
FILE: coding_interviews/cracking-the-coding-interview/big_o/example9.py
================================================
def sum(node):
if node is None:
return 0
return sum(node.left) + node.value + sum(node.right)
# If we have N nodes in our tree, this will be O(N) complexity
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/check-permutation/check-permutation.js
================================================
// Given two strings, write a method to decide if one is a permutation of the other
// If they have different lengths, they are not permutations
// Build a hashmap of characters of one of the strings
// Iterate through the other string and check if the characters are in the hashmap
// If there's no match in the hashmap, they are not permutations
// If it passes the loop, they are permutations.
// Runtime Complexity: O(N), where N = the length of the string
// Space Complexity: O(N), where N = the length of the string
function buildCharsMap(string) {
const charsMap = new Map();
for (let char of string) {
if (charsMap.has(char)) charsMap.set(char, charsMap.get(char) + 1);
else charsMap.set(char, 1);
}
return charsMap;
}
export function checkPermutation(s1, s2) {
if (s1.length !== s2.length) return false;
const charsMap = buildCharsMap(s1);
for (let char of s2) {
if (!charsMap.has(char)) {
return false;
}
if (charsMap.get(char) === 0) {
return false;
}
charsMap.set(char, charsMap.get(char) - 1);
}
return true;
}
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/check-permutation/check-permutation.test.js
================================================
import { describe, expect, it } from 'vitest';
import { checkPermutation } from './check-permutation';
describe('checkPermutation', () => {
it('returns the correct results', () => {
expect(checkPermutation('aba', 'aab')).toBeTruthy();
});
it('returns the correct results', () => {
expect(checkPermutation('aba', 'aaba')).toBeFalsy();
});
it('returns the correct results', () => {
expect(checkPermutation('aba', 'aa')).toBeFalsy();
});
});
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/cpp/remove_specified_character.cpp
================================================
#include <iostream>
#include <string>
using namespace std;
int main() {
string word, characteres, result = "";
getline(cin, word);
cin >> characteres;
for (int i = 0; i < word.size(); i++) {
int belongs_to = 0;
for (int j = 0; j < characteres.size(); j++) {
if (word[i] == characteres[j]) {
belongs_to = 1;
break;
}
}
if (!belongs_to) result += word[i];
}
cout << result << endl;
return 0;
}
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/is-unique/is-unique.js
================================================
// Is Unique: Implement an algorithm to determine if a string has all unique characters.
// Using a hashmap to count the number of characters in the string
// if there's already a character, it should return false as a result
// if it passes the entire string, it means it's a string with unique characters
// Time Complexity: O(N), N = number of charactes in the string
// Space Complexity: O(N), N = number of charactes in the string stored in the `charMap` hashmap
export function isUnique(string) {
const charMap = new Map();
for (let char of string) {
if (charMap.has(char)) return false;
charMap.set(char, 1);
}
return true;
}
// Using a set to store all unique characters of the string
// if the size of the set is equal to the string, the string has unique characters
// Time Complexity: O(N), N = number of charactes in the string
// Space Complexity: O(N), N = number of charactes in the string stored in the `uniqueChars` set
export function isUniqueWithSet(string) {
const uniqueChars = new Set();
for (let char of string) {
uniqueChars.add(char);
}
return uniqueChars.size === string.length;
}
// Using a set to store all unique characters of the string
// A simplified version using the Set constructor
// Time Complexity: O(N), N = number of charactes in the string
// Space Complexity: O(N), N = number of charactes in the string stored in the `uniqueChars` set
export function isUniqueWithSetSimplified(string) {
return string.length === new Set(string).size;
}
// --- What if you cannot use additional data structures? ---
// Comparing each character with all the other characters
// Runtime Complexity: O(N^2)
// Space Complexity: O(1)
export function isUniqueNSquare(string) {
for (let i = 0; i < string.length; i++) {
for (let j = i + 1; j < string.length; j++) {
if (string[i] === string[j]) return false;
}
}
return true;
}
// Sorting and comparing adjacent characters
// Runtime Complexity: O(NlogN) because of the sorting runtime complexity
// Space Complexity: O(N) because of the newly created array
export function isUniqueWithoutDS(string) {
let sortedString = [...string].sort(
(a, b) => a.charCodeAt() - b.charCodeAt()
);
for (let index = 0; index < sortedString.length - 1; index++) {
if (sortedString[index] === sortedString[index + 1]) return false;
}
return true;
}
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/is-unique/is-unique.test.js
================================================
import { describe, expect, it } from 'vitest';
import {
isUnique,
isUniqueNSquare,
isUniqueWithSet,
isUniqueWithSetSimplified,
isUniqueWithoutDS,
} from './is-unique';
const unique = 'asdfghjkl';
const nonUnique = 'asdfghjkla';
describe('isUnique', () => {
it('returns correct result', () => {
expect(isUnique(unique)).toBeTruthy();
});
it('returns false for non-unique characters', () => {
expect(isUnique(nonUnique)).toBeFalsy();
});
});
describe('isUniqueWithSet', () => {
it('returns true for unique characters', () => {
expect(isUniqueWithSet(unique)).toBeTruthy();
});
it('returns false for non-unique characters', () => {
expect(isUniqueWithSet(nonUnique)).toBeFalsy();
});
});
describe('isUniqueWithSetSimplified', () => {
it('returns true for unique characters', () => {
expect(isUniqueWithSetSimplified(unique)).toBeTruthy();
});
it('returns false for non-unique characters', () => {
expect(isUniqueWithSetSimplified(nonUnique)).toBeFalsy();
});
});
describe('isUniqueNSquare', () => {
it('returns true for unique characters', () => {
expect(isUniqueNSquare(unique)).toBeTruthy();
});
it('returns false for non-unique characters', () => {
expect(isUniqueNSquare(nonUnique)).toBeFalsy();
});
});
describe('isUniqueWithoutDS', () => {
it('returns true for unique characters', () => {
expect(isUniqueWithoutDS(unique)).toBeTruthy();
});
it('returns false for non-unique characters', () => {
expect(isUniqueWithoutDS(nonUnique)).toBeFalsy();
});
});
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/one-away/one-away.js
================================================
// One Away: There are three types of edits that can be performed on strings: insert a character, remove a character, or replace a character.
// Given two strings, write a function to check if they are one edit (or zero edits) away
// Examples
// pale, ple -> true
// pales, pale -> true
// pale, bale -> true
// pale, bake -> false
/**
* pale => {p: 1, a: 1, l: 1, e: 1}
* ple => {p: 1, l: 1, e: 1}
* bake => {b: 1, a: 1, k: 1, e: 1}
*/
function buildCharsCount(string) {
let charsCount = new Map();
for (let char of string) {
if (charsCount.has(char)) charsCount.set(char, charsCount.get(char) + 1);
else charsCount.set(char, 1);
}
return charsCount;
}
export function oneAway(s1, s2) {
if (s1.length - s2.length >= 2) return false;
if (s2.length - s1.length >= 2) return false;
let charsCount1 = buildCharsCount(s1);
let charsCount2 = buildCharsCount(s2);
let string = charsCount1.size >= charsCount2.size ? s1 : s2;
let [map1, map2] =
charsCount1.size >= charsCount2.size
? [charsCount1, charsCount2]
: [charsCount2, charsCount1];
let numberOfEdits = 0;
for (let char of string) {
let count1 = map1.get(char) || 0;
let count2 = map2.get(char) || 0;
numberOfEdits += count1 - count2;
}
return [0, 1].includes(numberOfEdits);
}
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/one-away/one-away.test.js
================================================
import { describe, expect, it } from 'vitest';
import { oneAway } from './one-away';
describe('oneAway', () => {
it('', () => {
expect(oneAway('pale', 'ple')).toEqual(true);
expect(oneAway('pale', 'pale')).toEqual(true);
expect(oneAway('pales', 'pale')).toEqual(true);
expect(oneAway('pale', 'bale')).toEqual(true);
expect(oneAway('paalle', 'paklle')).toEqual(true);
expect(oneAway('paalle', 'paklle')).toEqual(true);
expect(oneAway('1203', '1213')).toEqual(true);
expect(oneAway('pale', 'bake')).toEqual(false);
expect(oneAway('palee', 'ple')).toEqual(false);
});
});
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/palindrome-permutation/palindrome-permutation.js
================================================
// Palindrome Permutation: Given a string, write a function to check if it is a permutation of a palindrome.
// A palindrome is a word or phrase that is the same forwards and backwards.
// A permutation is a rearrangement of letters. The palindrome does not need to be limited to just dictionary words.
// You can ignore casing and non-letter characters.
// Example:
// Tact Coa
// - taco cat
// - atco cta
// Runtime Complexity: O(N), where N = the true length of the string
// Space Complexity: O(N), where N = the true length of the string in the hashmap
function isAlpha(char) {
return /[_a-zA-Z]/.test(char);
}
function buildMapOsChars(string) {
const charsMap = new Map();
const downcasedString = string.toLowerCase();
for (let char of downcasedString) {
if (!isAlpha(char)) continue;
if (charsMap.has(char)) charsMap.set(char, charsMap.get(char) + 1);
else charsMap.set(char, 1);
}
return charsMap;
}
export function palindromePermutation(string) {
let charsMap = buildMapOsChars(string);
let numberOfCharsWithOneCount = 0;
for (let [_, count] of charsMap.entries()) {
numberOfCharsWithOneCount += count % 2;
}
return numberOfCharsWithOneCount <= 1;
}
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/palindrome-permutation/palindrome-permutation.test.js
================================================
import { describe, expect, it } from 'vitest';
import { palindromePermutation } from './palindrome-permutation';
describe('palindromePermutation', () => {
it('', () => {
expect(palindromePermutation('Tact Coa')).toEqual(true);
});
it('', () => {
expect(palindromePermutation('tat')).toEqual(true);
});
it('', () => {
expect(palindromePermutation('abcd')).toEqual(false);
});
it('', () => {
expect(palindromePermutation('tactfcoa')).toEqual(false);
});
it('', () => {
expect(palindromePermutation('tactfffcoa')).toEqual(false);
});
});
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.01.py
================================================
'''
Is Unique: Implement an algorithm to determine if a string has all unique characters.
What if you cannot use additional data structures?
- Examples:
abc => True
aaa => False
abcdefghij => True
abcdefghia => False
Some questions:
- Could the string be an empty string?
- What's the memory constraints?
'''
# First approach using Hash Map
def all_unique_characters(string):
characters_counter = {}
for char in string:
if char in characters_counter:
characters_counter[char] += 1
else:
characters_counter[char] = 1
for char, counter in characters_counter.items():
if counter > 1:
return False
return True
print(all_unique_characters('abc'))
print(all_unique_characters('aaa'))
print(all_unique_characters('abcdefghij'))
print(all_unique_characters('abcdefghia'))
# Second approach using Set
def all_unique_characters(string):
unique_chars = set()
for char in string:
unique_chars.add(char)
return len(unique_chars) == len(string)
print(all_unique_characters('abc'))
print(all_unique_characters('aaa'))
print(all_unique_characters('abcdefghij'))
print(all_unique_characters('abcdefghia'))
'''
Both approaches are:
- Space: O(N)
- Time: O(N)
'''
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.02.py
================================================
'''
Check Permutation: Given two strings, write a method to decide if one is a
permutation of the other.
- Examples:
"abc" "bca" => True
"abc" "bca" => True
"abc" "aab" => False
"abc" "baca" => False
Questions:
- Do the strings have the same length?
'''
def permutation(str1, str2):
if len(str1) != len(str2):
return False
return sorted(str1) == sorted(str2)
print(permutation("abc", "bca"))
print(permutation("abc", "bca"))
print(permutation("abc", "aab"))
print(permutation("abc", "baca"))
'''
This is:
- Space: O(1) (no new storage of the string)
- Time: O(NlogN) (because of the sorting)
'''
def permutation(str1, str2):
if len(str1) != len(str2):
return False
first_set = set()
second_set = set()
for char in str1:
first_set.add(char)
for char in str2:
second_set.add(char)
return first_set == second_set
print(permutation("abc", "bca"))
print(permutation("abc", "bca"))
print(permutation("abc", "aab"))
print(permutation("abc", "baca"))
'''
This is:
- Space: O(N) (for each string we have a new set with N places - N is equal to the string length)
- Time: O(N) (just the str1 and str2 iteration)
'''
def permutation(str1, str2):
if len(str1) != len(str2):
return False
characters = {}
for char in str1:
if char in characters:
characters[char] += 1
else:
characters[char] = 1
for char in str2:
if char not in characters or characters[char] == 0:
return False
characters[char] -= 1
return True
print(permutation("abc", "bca"))
print(permutation("abc", "bca"))
print(permutation("abc", "aab"))
print(permutation("abc", "baca"))
'''
This is:
- Space: O(N) (new dictionary for the first string with N places - N is equal to the string length)
- Time: O(N) (just the str1 and str2 iteration)
'''
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.03.py
================================================
'''
URLify: Write a method to replace all spaces in a string with '%20'.
You may assume that the string has sufficient space at the end to hold
the additional characters, and that you are given the "true" length of the string.
Example:
Input: "Mr John Smith ", 13
Output: "Mr%20John%20Smith"
'''
def urlify(string, length):
original_string = string[0:length]
chars = []
for char in original_string:
if char is " ":
chars.append("%20")
else:
chars.append(char)
return "".join(chars)
result = urlify("Mr John Smith ", 13) # => "Mr%20John%20Smith"
print(result)
result = urlify("Mr John Smith ", 14) # => "Mr%20John%20Smith%20"
print(result)
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.04.py
================================================
'''
Palindrome Permutation: Given a string, write a function to check if it is a permutation of a palindrome.
A palindrome is a word or phrase that is the same forwards and backwards. A permutation
is a rearrangement of letters. The palindrome does not need to be limited to just dictionary words.
Example
Input: Tact Coa
Output: True (permutations: "taco cat", "atco eta", etc.)
'''
def is_even(number):
return number % 2 == 0
def is_even_length(string):
return is_even(len(string))
def is_palindrome_permutation(string):
string = string.lower()
string = "".join(string.split())
even = is_even_length(string)
char_counter = {}
odd = 0
for char in string:
if char in char_counter:
char_counter[char] += 1
else:
char_counter[char] = 1
for char, counter in char_counter.items():
if not is_even(counter):
odd += 1
return (even and odd == 0) or (not even and not is_even(odd))
result = is_palindrome_permutation('Tact Coa')
print(result) # True
result = is_palindrome_permutation('Tac Coa')
print(result) # False
result = is_palindrome_permutation('Tac Tac')
print(result) # True
data = [
('Tact Coa', True),
('Tac Coa', False),
('Tac Tac', True)
]
for [string, expected] in data:
actual = is_palindrome_permutation(string)
print(actual == expected)
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.05.py
================================================
'''
One Away: There are three types of edits that can be performed on strings:
insert a character, remove a character, or replace a character.
Given two strings, write a function to check if they are one edit (or zero edits) away.
Example:
pale, ple -> true
pales, pale -> true
pale, bale -> true
pale, bake -> false
bla, bleble -> false
'''
def is_two_chars_away(str1, str2):
return (len(str1) - len(str2) >= 2) or (len(str2) - len(str1) >= 2)
def number_of_needed_changes(bigger_str, smaller_str):
str_counter = {}
for char in bigger_str:
if char in str_counter:
str_counter[char] += 1
else:
str_counter[char] = 1
for char in smaller_str:
if char in str_counter:
str_counter[char] -= 1
needed_changes = 0
for char, counter in str_counter.items():
needed_changes += counter
return needed_changes
def one_away(str1, str2):
if is_two_chars_away(str1, str2):
return False
needed_changes = 0
if len(str1) >= len(str2):
needed_changes = number_of_needed_changes(str1, str2)
else:
needed_changes = number_of_needed_changes(str2, str1)
return needed_changes <= 1
data = [
('pale', 'ple', True),
('pales', 'pale', True),
('pale', 'bale', True),
('paleabc', 'pleabc', True),
('pale', 'ble', False),
('a', 'b', True),
('', 'd', True),
('d', 'de', True),
('pale', 'pale', True),
('pale', 'ple', True),
('ple', 'pale', True),
('pale', 'bale', True),
('pale', 'bake', False),
('pale', 'pse', False),
('ples', 'pales', True),
('pale', 'pas', False),
('pas', 'pale', False),
('pale', 'pkle', True),
('pkle', 'pable', False),
('pal', 'palks', False),
('palks', 'pal', False),
('bla', 'bleble', False)
]
for [test_s1, test_s2, expected] in data:
actual = one_away(test_s1, test_s2)
print(actual == expected)
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.06.py
================================================
'''
String Compression: Implement a method to perform basic string compression using the
counts of repeated characters. For example, the string aabcccccaaa would become a2b1c5a3.
If the "compressed" string would not become smaller than the original string,
our method should return the original string.
You can assume the string has only uppercase and lowercase letters (a - z).
'''
def string_compression(string):
if string is '':
return ''
counter = 1
current_char = string[0]
compressed_string = []
for char in string[1:]:
if char == current_char:
counter += 1
else:
compressed_string.append(current_char)
compressed_string.append(str(counter))
current_char = char
counter = 1
compressed_string.append(current_char)
compressed_string.append(str(counter))
return ''.join(compressed_string)
test_cases = [
('Aa', 'A1a1'),
('aabcccccaaa', 'a2b1c5a3'),
('', ''),
('abcdef', 'a1b1c1d1e1f1')
]
for [string, expected] in test_cases:
actual = string_compression(string)
print(actual == expected)
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.07.py
================================================
'''
Rotate Matrix: Given an image represented by an NxN matrix,
where each pixel in the image is 4 bytes,
write a method to rotate the image by 90 degrees.
Can you do this in place?
'''
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/bottlenecks.py
================================================
'''
Example: Given an array of distinct integer values, count the number of pairs of integers that
have difference k. For example, given the array { 1, 7, 5, 9, 2, 12, 3 } and the difference
k = 2,there are four pairs with difference2: (1, 3), (3, 5), (5, 7), (7, 9).
'''
def pairs_of_difference(array, diff):
hash_table = {}
for num in array:
hash_table[num] = num
count = 0
for num in array:
if num + diff in hash_table: count += 1
if num - diff in hash_table: count += 1
return count // 2
print(pairs_of_difference([1, 7, 5, 9, 2, 12, 3], 2))
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/is_unique.py
================================================
import time
import unittest
from collections import defaultdict
def is_unique_chars_using_dictionary(text):
char_counter = {}
for char in text:
if char in char_counter:
return False
else:
char_counter[char] = 1
return True
class Test(unittest.TestCase):
test_cases = [
("abcd", True),
("s4fad", True),
("", True),
("23ds2", False),
("hb 627jh=j ()", False),
("".join([chr(val) for val in range(128)]), True), # unique 128 chars
("".join([chr(val // 2) for val in range(129)]), False), # non-unique 129 chars
]
test_functions = [
is_unique_chars_using_dictionary,
# is_unique_chars_sorting,
]
def test_is_unique_chars(self):
num_runs = 1000
function_runtimes = defaultdict(float)
for _ in range(num_runs):
for text, expected in self.test_cases:
for is_unique_chars in self.test_functions:
start = time.perf_counter()
assert (
is_unique_chars(text) == expected
), f"{is_unique_chars.__name__} failed for value: {text}"
function_runtimes[is_unique_chars.__name__] += (
time.perf_counter() - start
) * 1000
print(f"\n{num_runs} runs")
for function_name, runtime in function_runtimes.items():
print(f"{function_name}: {runtime:.1f}ms")
if __name__ == "__main__":
unittest.main()
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/string-compression/string-compression.js
================================================
// String Compression: Implement a method to perform basic string compression using the counts of repeated characters.
// For example, the string `aabcccccaaa` would become `a2b1c5a3`.
// If the "compressed" string would not become smaller than the original string, your method should return the original string.
// You can assume the string has only uppercase and lowercase letters (a-z)
function compress(chars) {
let index = 0,
p1 = 0;
while (p1 < chars.length) {
let p2 = p1;
while (p2 < chars.length && chars[p1] === chars[p2]) {
p2++;
}
let count = p2 - p1;
chars[index++] = chars[p1];
if (count > 1) {
let countString = count.toString();
for (let char of countString) {
chars[index++] = char;
}
}
p1 = p2;
}
return chars;
}
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/urlify/urlify.js
================================================
// URLlify: Write a method to replace all spaces in a string with '%20'.
// You may assume that the string has sufficient space at the end to hold the additional characters,
// and that you are given the "true" length of the string
// Runtime Complexity: O(N), where N = the true length of the string
// Space Complexity: O(N), where N = the true length of the string in the new array
export function urlify(string, length, placeholder = '%20') {
let output = [];
let lastChar = '';
let space = ' ';
for (let index = 0; index < length; index++) {
let char = string[index];
if (char !== space) {
output.push(char);
}
if (char === space && lastChar !== space) {
output.push(placeholder);
}
lastChar = char;
}
return output.join('');
}
// Runtime Complexity: O(N), where N = the true length of the string
// Space Complexity: O(N), where N = the true length of the string in the new array
export function urlifyForward(string, length, placeholder = '%20') {
let output = [];
let index = 0;
let space = ' ';
const moveForward = () => {
while (string[index] === space) {
index++;
}
};
while (index < length) {
if (string[index] === space) {
output.push(placeholder);
moveForward();
} else {
output.push(string[index]);
index++;
}
}
return output.join('');
}
================================================
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/urlify/urlify.test.js
================================================
import { describe, expect, it } from 'vitest';
import { urlify, urlifyForward } from './urlify';
describe('urlify', () => {
it('', () => {
expect(urlify('Mr John Smith ', 13)).toEqual('Mr%20John%20Smith');
});
});
describe('urlifyForward', () => {
it('', () => {
expect(urlifyForward('Mr John Smith ', 13)).toEqual(
'Mr%20John%20Smith'
);
});
});
================================================
FILE: coding_interviews/daily_code_problems/001.py
================================================
"""
Given a list of numbers and a number k, return whether any two numbers from the list add up to k.
For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17.
"""
def found_sum_of_two_numbers_brute_force(k, numbers):
for index_1 in range(len(numbers)):
for index_2 in range(index_1, len(numbers)):
if numbers[index_1] + numbers[index_2] == k:
return True
return False
def found_sum_of_two_numbers(k, numbers):
start = 0
end = len(numbers) - 1
sorted_numbers = sorted(numbers)
while start < end:
if sorted_numbers[start] + sorted_numbers[end] == k:
return True
elif sorted_numbers[start] + sorted_numbers[end] > k:
end -= 1
else:
start += 1
return False
def test_algorithm(k, numbers):
print('Brute force:', found_sum_of_two_numbers_brute_force(k, numbers))
print('Optmized:', found_sum_of_two_numbers(k, numbers))
print()
test_algorithm(17, [10, 15, 3, 7])
test_algorithm(17, [15, 10, 3, 7])
test_algorithm(17, [15, 10, 3, 8])
================================================
FILE: coding_interviews/daily_code_problems/002.py
================================================
"""
Given an array of integers,
return a new array such that each element at index i of the new
array is the product of all the numbers in the original array except the one at i.
For example, if our input was [1, 2, 3, 4, 5],
the expected output would be [120, 60, 40, 30, 24].
If our input was [3, 2, 1], the expected output would be [2, 3, 6].
"""
from functools import reduce
def product_with_exception(integers):
product_of_all = reduce((lambda product, item: product * item), integers)
return list(map(lambda item: product_of_all / item, integers))
def test_product_with_exception(integers, result):
print(product_with_exception(integers) == result)
test_product_with_exception([1, 2, 3, 4, 5], [120, 60, 40, 30, 24])
test_product_with_exception([3, 2, 1], [2, 3, 6])
test_product_with_exception(
[-20, 20, 50, 10], [10000, -10000, -4000, -20000])
================================================
FILE: coding_interviews/daily_code_problems/003.py
================================================
'''
Given the root to a binary tree, implement serialize(root),
which serializes the tree into a string, and deserialize(s),
which deserializes the string back into the tree.
For example, given the following Node class
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
The following test should pass:
node = Node('root', Node('left', Node('left.left')), Node('right'))
assert deserialize(serialize(node)).left.left.val == 'left.left'
serialize --> 'root' 'left' 'left.left' 'right'
deserialize --> Node('root', Node('left', Node('left.left')), Node('right'))
'''
from queue import Queue
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
def serialize(node):
if node is None:
return 'X '
return node.val + ' ' + serialize(node.left) + serialize(node.right)
def deserialize_node(nodes):
value = nodes.get()
if value == 'X':
return None
node = Node(value)
node.left = deserialize_node(nodes)
node.right = deserialize_node(nodes)
return node
def create_nodes_queue(string):
nodes = string.split(' ')
queue = Queue()
for node in nodes:
queue.put(node)
return queue
def deserialize(string):
string = string.strip()
nodes = create_nodes_queue(string)
return deserialize_node(nodes)
def pre_order(tree):
if tree is None:
return
print(tree.val)
pre_order(tree.left)
pre_order(tree.right)
node = Node('root', Node('left', Node('left.left')), Node('right'))
serialized_node = serialize(node)
print(serialized_node)
tree = deserialize(serialized_node)
print(pre_order(tree))
================================================
FILE: coding_interviews/daily_code_problems/004.py
================================================
'''
Given an array of integers, find the first missing positive integer in linear time and constant space.
In other words, find the lowest positive integer that does not exist in the array.
The array can contain duplicates and negative numbers as well.
For example, the input [3, 4, -1, 1] should give 2. The input [1, 2, 0] should give 3.
You can modify the input array in-place.
'''
# using a hash table: linear time and linear space
def get_lowest(lowest, present_numbers):
while lowest in present_numbers:
lowest += 1
return lowest
def lowest_positive_integer(numbers):
present_numbers = {}
lowest = 1
for number in numbers:
present_numbers[number] = True
return get_lowest(lowest, present_numbers)
result = lowest_positive_integer([3, 4, -1, 1])
print(result)
result = lowest_positive_integer([3, 4, 2, -1, 1])
print(result)
result = lowest_positive_integer([5, 4, 2, -1, 1])
print(result)
================================================
FILE: coding_interviews/daily_code_problems/005.py
================================================
'''
cons(a, b) constructs a pair, and car(pair) and cdr(pair)
returns the first and last element of that pair.
For example, car(cons(3, 4)) returns 3, and cdr(cons(3, 4)) returns 4.
Given this implementation of cons:
def cons(a, b):
def pair(f):
return f(a, b)
return pair
Implement car and cdr.
'''
def cons(a, b):
def pair(f):
return f(a, b)
return pair
def list_pair(a, b):
return [a, b]
def car(pair):
[a, _] = pair(list_pair)
return a
def cdr(pair):
[_, b] = pair(list_pair)
return b
a = 1
b = 2
result = car(cons(a, b))
print(result)
result = cdr(cons(a, b))
print(result)
================================================
FILE: coding_interviews/daily_code_problems/006.py
================================================
'''
An XOR linked list is a more memory efficient doubly linked list.
Instead of each node holding next and prev fields, it holds a field named both,
which is an XOR of the next node and the previous node.
Implement an XOR linked list; it has an add(element) which adds the element to the end,
and a get(index) which returns the node at index.
If using a language that has no pointers (such as Python),
you can assume you have access to get_pointer and dereference_pointer functions
that converts between nodes and memory addresses.
'''
================================================
FILE: coding_interviews/daily_code_problems/007.py
================================================
'''
Given the mapping a = 1, b = 2, ... z = 26, and an encoded message,
count the number of ways it can be decoded.
For example, the message '111' would give 3, since it could be decoded as 'aaa', 'ka', and 'ak'.
You can assume that the messages are decodable. For example, '001' is not allowed.
'''
def count_decoded_possibilities(encoded_message):
pass
count = count_decoded_possibilities('111')
print(count) # 3 - 'aaa', 'ka', and 'ak'
count = count_decoded_possibilities('121')
print(count) # 3 - 'aba', 'la', 'au'
================================================
FILE: coding_interviews/daily_code_problems/README.md
================================================
# Daily Code Problem
- [001](001.py)
- [002](002.py)
- [003](003.py)
- [004](004.py)
- [005](005.py)
- [006](006.py)
- [007](007.py)
Problems: https://www.dailycodingproblem.com
================================================
FILE: coding_interviews/elements_of_programming_interview/array.py
================================================
# Your input is an array of
# integers, and you have to reorder its entries
# so that the even entries appear first.
def even_before_odd(numbers):
next_even, next_odd = 0, len(numbers)
while next_even < next_odd:
if numbers[next_even] % 2 == 0:
next_even += 1
else:
numbers[next_even], numbers[next_odd] = numbers[next_odd], numbers[next_even]
next_odd -= 1
## With this solution, we have a O(1) space complexity and O(N) time complexity
================================================
FILE: coding_interviews/elements_of_programming_interview/base_conversion.py
================================================
'''
"615"
"5" --> 5 --> 5 * (7 ** 0)
"1" --> 1 --> 1 * (7 ** 1)
"6" --> 6 --> 6 * (7 ** 2)
=> 306
306 % 13 = 7
306 / 13 = 23
23 % 13 = 10
23 / 13 = 1
1 % 13 = 1
'''
num_representation = {
10: 'A',
11: 'B',
12: 'C',
13: 'D',
14: 'E',
15: 'F',
}
def to_num_representation(num):
if num < 10:
return str(num)
return num_representation[num]
def base_conversion(string_num, base1, base2):
decimal = 0
reversed_string_num = string_num[::-1]
for index in range(len(reversed_string_num)):
char_num = reversed_string_num[index]
decimal += int(char_num) * (base1 ** index)
digits = []
while decimal:
modulo = decimal % base2
decimal = decimal // base2
digits.append(to_num_representation(modulo))
return ''.join(digits)[::-1]
print(base_conversion("615", 7, 13))
================================================
FILE: coding_interviews/elements_of_programming_interview/buy_and_sell_stock_once.py
================================================
# Buy and Sell stoks once
def buy_and_sell_stock_once(prices):
if not prices:
return 0
min_price, max_profit = float('inf'), 0.0
for price in prices:
profit_if_sell_today = price - min_price
max_profit = max(max_profit, profit_if_sell_today)
min_price = min(min_price, price)
return max_profit
prices = [310, 315, 275, 295, 260, 270, 290, 230, 255, 250]
print(buy_and_sell_stock_once(prices))
print(buy_and_sell_stock_once([]))
================================================
FILE: coding_interviews/elements_of_programming_interview/can_reach_end.py
================================================
"""
In a particular board game, a player has to try to advance through a sequence of positions.
Each position has a nonnegative integer associated with it, representing the maximum you can advance
from that position in one move. You begin in the first position and win by getting to the last position.
For example, let A = (3,3,1,0,2,0,1) represent the board game, i.e., the lth entry in A is the maximum we
can advance from L Then the game can be won by the following sequence of advances through A: take 1 step
from A[0] to A[1], then 3 steps from A[1] to A[4], then 2 steps from A[4] to A[6], which is the last position.
Note that A[0] = 3 >= 1, A[1] =3 >= 3, and A[4] = 2 >= 2, so all moves are valid. If A instead was (3,2,0,0,2,0,1),
it would not be possible to advance past position 3, so the game cannot be won.
Write a program that takes an array of n integers, where A[i] denotes the maximum you can advance from the index i,
and returns whether it is possible to advance to the last index starting from the beginning of the array.
"""
def can_reach_end(board_game):
furthest_reach_so_far, last_index = 0, len(board_game) - 1
current_index = 0
while current_index <= furthest_reach_so_far and furthest_reach_so_far < last_index:
furthest_reach_so_far = max(furthest_reach_so_far, board_game[current_index] + current_index)
current_index += 1
return furthest_reach_so_far >= last_index
print(can_reach_end([3, 3, 7, 0, 2, 0, 1]))
print(can_reach_end([2, 4, 1, 1, 0, 2, 3]))
print(can_reach_end([3, 2, 0, 0, 2, 0, 1]))
================================================
FILE: coding_interviews/elements_of_programming_interview/delete_duplicates_from_a_sorted_array.py
================================================
# input: [2,3,5,5,7,11,11,11,13]
# output: [2,3,5,7,11,13,0,0,0]
# input: [-2,-2,1]
# output: [-2,1,0]
# input: [0,0,1,1]
# output: [0,1,0,0]
'''
result = []
counter = {}
loop input
is not in the counter
counter[number] << True
result << number
n = len(input) - len(result)
loop n
result << 0
return result
Space: O(2N) = O(N)
Runtime: O(N)
'''
def delete_duplicates(numbers):
if not numbers:
return [[], 0]
result = []
counter_mapper = {}
counter = 0
for number in numbers:
if number not in counter_mapper:
counter_mapper[number] = True
result.append(number)
counter += 1
difference_of_lengths = len(numbers) - len(result)
for _ in range(difference_of_lengths):
result.append(0)
return [result, counter]
def test(input, expect):
print(delete_duplicates(input) == expect)
test([2,3,5,5,7,11,11,11,13], [[2,3,5,7,11,13,0,0,0],6])
test([-2,-2,1], [[-2,1,0],2])
test([0,0,1,1], [[0,1,0,0],2])
test([], [[],0])
def delete_duplicates_2(numbers):
counter = 1
if not numbers:
return [[], 0]
for index in range(1, len(numbers)):
if numbers[index - 1] != numbers[index]:
numbers[counter] = numbers[index]
counter += 1
difference_of_lengths = len(numbers) - counter
for index in range(difference_of_lengths):
numbers[len(numbers) - index - 1] = 0
return [numbers, counter]
def test_2(input, expect):
print(delete_duplicates(input) == expect)
test_2([2,3,5,5,7,11,11,11,13], [[2,3,5,7,11,13,0,0,0],6])
test_2([-2,-2,1], [[-2,1,0],2])
test_2([0,0,1,1], [[0,1,0,0],2])
test_2([], [[],0])
================================================
FILE: coding_interviews/elements_of_programming_interview/interconvert_string_and_integer.py
================================================
# Interconvert String and Integer
'''
"123" => 123
"-123" => -123
'''
def to_int(string):
sign = 1
if string[0] == '-':
sign = -1
string = string[1:]
integer = 0
reversed_string = string[::-1]
for index in range(len(string)):
int_char = reversed_string[index]
digit = ord(int_char) - 48
integer += (digit * 10 ** index)
return integer * sign
print(to_int('123'))
print(to_int('-123'))
'''
123 => "123"
-123 => "-123"
'''
def to_string(integer):
sign = ''
if integer < 0:
sign = '-'
abs_integer = abs(integer)
digits = []
while abs_integer > 0:
digits.append(chr(ord('0') + abs_integer % 10))
abs_integer = abs_integer // 10
return sign + ''.join(digits[::-1])
print(to_string(123))
print(to_string(-123))
================================================
FILE: coding_interviews/elements_of_programming_interview/longest_subarray_length_with_same_integers.py
================================================
'''
Write a program that takes an array of integers and finds
the length of a longest subarray all of whose entries are equal.
'''
def longest_subarray_length_with_same_integers(numbers):
if not numbers:
return 0
longest_subarray_length, counter, current_comparator = 0, 0, numbers[0]
for number in numbers:
if number == current_comparator:
counter += 1
else:
counter = 1
current_comparator = number
longest_subarray_length = max(longest_subarray_length, counter)
return longest_subarray_length
numbers = [260, 290, 290, 250, 250, 250]
prices = [310, 315, 275, 295, 260, 270, 290, 230, 255, 250]
print(longest_subarray_length_with_same_integers(numbers))
print(longest_subarray_length_with_same_integers(prices))
print(longest_subarray_length_with_same_integers([]))
================================================
FILE: coding_interviews/elements_of_programming_interview/multiply_two_arbitrary_precision_integers.py
================================================
# Write a program that takes two arrays representing integers,
# and retums an integer representing their product
"""
1234
4321
result1 = 1 x 4 + 1 x 3 x 10 + 1 x 2 x 100 + 1 x 1 x 1000
result2 = ...
result3 = ...
result4 = ...
result = result1 + result2 + result3 + result4
"""
def multiply_two_arbitrary_precision_integers(int1, int2):
result = 0
for integer in int1:
for index in range(len(int2)):
result += integer * int2[len(int2) - 1 - index] * pow(10, index)
return result
print(multiply_two_arbitrary_precision_integers([1,9,3,7,0,7,7,2,1], [-7,6,1,8,3,8,2,5,7,2,8,7]))
================================================
FILE: coding_interviews/elements_of_programming_interview/spreadsheet_column_encoding.py
================================================
encoding_mapper = {
'A': 1,
'B': 2,
'C': 3,
'D': 4,
'E': 5,
'F': 6,
'G': 7,
'H': 8,
'I': 9,
'J': 10,
'K': 11,
'L': 12,
'M': 13,
'N': 14,
'O': 15,
'P': 16,
'Q': 17,
'R': 18,
'S': 19,
'T': 20,
'U': 21,
'V': 22,
'W': 23,
'X': 24,
'Y': 25,
'Z': 26,
}
def spreadcheet_column_encoding(encoding):
number, reversed_encoding = 0, encoding[::-1]
for index in range(len(reversed_encoding)):
number += (26 ** index) * (encoding_mapper[reversed_encoding[index]])
return number
================================================
FILE: coding_interviews/hackerrank_interview_prep_kit/hash_tables/count_triplets.py
================================================
# https://www.hackerrank.com/challenges/count-triplets-1/problem?h_l=interview&h_r=next-challenge&h_r%5B%5D%5B%5D%5B%5D=next-challenge&h_r%5B%5D%5B%5D%5B%5D=next-challenge&h_v=zen&h_v%5B%5D%5B%5D%5B%5D=zen&h_v%5B%5D%5B%5D%5B%5D=zen&isFullScreen=true&playlist_slugs%5B%5D%5B%5D%5B%5D%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D%5B%5D%5B%5D%5B%5D=dictionaries-hashmaps
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import Counter
def count_triplets(arr, r):
number_counter = Counter(arr)
prev_counter = Counter()
triplets = 0
for number in arr:
prev = number // r
next_num = number * r
number_counter[number] -= 1
if prev_counter[prev] and number_counter[next_num] and number % r == 0:
triplets += prev_counter[prev] * number_counter[next_num]
prev_counter[number] += 1
return triplets
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
nr = input().rstrip().split()
n = int(nr[0])
r = int(nr[1])
arr = list(map(int, input().rstrip().split()))
ans = count_triplets(arr, r)
fptr.write(str(ans) + '\n')
fptr.close()
================================================
FILE: coding_interviews/hackerrank_interview_prep_kit/hash_tables/ransom_note.py
================================================
# https://www.hackerrank.com/challenges/ctci-ransom-note/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=dictionaries-hashmaps
#!/bin/python3
import math
import os
import random
import re
import sys
def build_word_counter(magazine):
word_counter = {}
for word in magazine:
if word in word_counter:
word_counter[word] += 1
else:
word_counter[word] = 1
return word_counter
def check_notes_on_magazine(word_counter, note):
for word in note:
if word in word_counter and word_counter[word] > 0:
word_counter[word] -= 1
else:
print('No')
return
print('Yes')
def check_magazine(magazine, note):
word_counter = build_word_counter(magazine)
check_notes_on_magazine(word_counter, note)
if __name__ == '__main__':
first_multiple_input = input().rstrip().split()
m = int(first_multiple_input[0])
n = int(first_multiple_input[1])
magazine = input().rstrip().split()
note = input().rstrip().split()
check_magazine(magazine, note)
================================================
FILE: coding_interviews/hackerrank_interview_prep_kit/hash_tables/sherlock_and_anagrams.py
================================================
# https://www.hackerrank.com/challenges/sherlock-and-anagrams/problem?h_l=interview&h_r%5B%5D=next-challenge&h_r%5B%5D=next-challenge&h_v%5B%5D=zen&h_v%5B%5D=zen&playlist_slugs%5B%5D%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D%5B%5D=dictionaries-hashmaps&isFullScreen=true
def sherlock_and_anagrams(s):
substrings = {}
for i in range(0, len(s) - 1):
for index in range(0, len(s) - i):
sorted_substring = ''.join(sorted(s[index:index+i+1]))
if sorted_substring in substrings:
substrings[sorted_substring] += 1
else:
substrings[sorted_substring] = 1
count_anagrams = 0
for _, count in substrings.items():
if count > 0:
count_anagrams += (count * (count - 1) // 2)
return count_anagrams
print(sherlock_and_anagrams('abba'))
print(sherlock_and_anagrams('ifailuhkqq'))
print(sherlock_and_anagrams('kkkk'))
print(sherlock_and_anagrams('ifailuhkqqhucpoltgtyovarjsnrbfpvmupwjjjfiwwhrlkpekxxnebfrwibylcvkfealgonjkzwlyfhhkefuvgndgdnbelgruel'))
================================================
FILE: coding_interviews/hackerrank_interview_prep_kit/hash_tables/two_strings.py
================================================
# https://www.hackerrank.com/challenges/two-strings/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=dictionaries-hashmaps&h_r=next-challenge&h_v=zen
#!/bin/python3
import math
import os
import random
import re
import sys
def two_strings(s1, s2):
chars_presence = {}
for char in s1:
if char not in chars_presence:
chars_presence[char] = True
for char in s2:
if char in chars_presence:
return 'YES'
return 'NO'
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
q = int(input().strip())
for q_itr in range(q):
s1 = input()
s2 = input()
result = two_strings(s1, s2)
fptr.write(result + '\n')
fptr.close()
================================================
FILE: coding_interviews/hackerrank_interview_prep_kit/warmup/counting_valleys.py
================================================
# https://www.hackerrank.com/challenges/counting-valleys/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=warmup&h_r=next-challenge&h_v=zen
#!/bin/python3
import math
import os
import random
import re
import sys
def counting_valleys(steps, path):
valleys_count, level = 0, 0
for step in path:
if step == 'U':
level += 1
if level == 0:
valleys_count += 1
else:
level -= 1
return valleys_count
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
steps = int(input().strip())
path = input()
result = counting_valleys(steps, path)
fptr.write(str(result) + '\n')
fptr.close()
================================================
FILE: coding_interviews/hackerrank_interview_prep_kit/warmup/jumping_on_the_clouds.py
================================================
# https://www.hackerrank.com/challenges/jumping-on-the-clouds/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=warmup&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen
#!/bin/python3
import math
import os
import random
import re
import sys
def won_the_game(current, end_game):
return current == end_game
def is_cumulus(cloud):
return cloud == 0
def jumping_on_clouds(c):
current, jumps, end_game = 0, 0, len(c) - 1
while not won_the_game(current, end_game):
if current + 2 <= end_game and is_cumulus(c[current + 2]):
current += 2
else:
current += 1
jumps += 1
return jumps
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
n = int(input().strip())
c = list(map(int, input().rstrip().split()))
result = jumping_on_clouds(c)
fptr.write(str(result) + '\n')
fptr.close()
================================================
FILE: coding_interviews/hackerrank_interview_prep_kit/warmup/repeated_string.py
================================================
# https://www.hackerrank.com/challenges/repeated-string/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=warmup&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen
#!/bin/python3
import math
import os
import random
import re
import sys
#
# aba => 2
# n = 10
# abaabaabaa => 7
# 10 / len(s) => 3
# 10 % len(s) => 1
# 2 * 3 + 1
def repeatedString(s, n):
count_as = 0
for char in s:
if char == 'a':
count_as += 1
times = n // len(s)
remaining = n % len(s)
count_as = count_as * times
for index in range(0, remaining):
if s[index] == 'a':
count_as += 1
return count_as
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
s = input()
n = int(input().strip())
result = repeatedString(s, n)
fptr.write(str(result) + '\n')
fptr.close()
================================================
FILE: coding_interviews/hackerrank_interview_prep_kit/warmup/sales_by_match.py
================================================
# https://www.hackerrank.com/challenges/sock-merchant/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=warmup
#!/bin/python3
import math
import os
import random
import re
import sys
def sock_merchant(n, ar):
counter = {}
for num in ar:
if num in counter:
counter[num] += 1
else:
counter[num] = 1
count = 0
for _, num_count in counter.items():
count += num_count // 2
return count
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
n = int(input().strip())
ar = list(map(int, input().rstrip().split()))
result = sock_merchant(n, ar)
fptr.write(str(result) + '\n')
fptr.close()
================================================
FILE: coding_interviews/interviews/fair/decrementBinaryNumber.js
================================================
function countOnes(number) {
let counter = 0;
number.split('').forEach((char) => {
if (char === '1') counter++;
});
return counter;
}
function toBinary(number) {
return number.toString(2);
}
function toDecimal(number) {
return parseInt(number, 2);
}
function decrementBinary(number) {
return toBinary(toDecimal(number) - 1);
}
function decrementBinaryNumber(number, requests) {
const answer = [];
requests.forEach((request) => {
if (request === '?') {
answer.push(countOnes(number));
} else {
number = decrementBinary(number);
}
});
return answer;
}
================================================
FILE: coding_interviews/interviews/fair/diceTotalScore.js
================================================
function diceTotalScore(a, b, c) {
if (a === b && b === c) {
return 1000 * a;
}
if (a === b) {
return 500 * a;
}
if (a === c) {
return 500 * a;
}
if (b === c) {
return 500 * b;
}
return 100 * Math.min(a, b, c);
}
================================================
FILE: coding_interviews/interviews/fair/isSubmatrixFull.js
================================================
function isSubmatrixFull(numbers) {
const answer = [];
for (let i = 0; i < numbers[0].length - 2; i++) {
const subMatrixNumbers = new Set();
for (let row = 0; row < 3; row++) {
for (let col = i; col < i + 3; col++) {
subMatrixNumbers.add(numbers[row][col]);
}
}
answer.push(subMatrixNumbers.size === 9);
}
return answer;
}
================================================
FILE: coding_interviews/interviews/fair/sortChessSubsquares.js
================================================
function sortChessSubsquares(numbers, queries) {
queries.forEach(([x, y, w]) => {
const blacks = [];
const whites = [];
for (let row = x; row < x + w; row++) {
for (let col = y; col < y + w; col++) {
if ((row + col) % 2 === 0) {
blacks.push(numbers[row][col]);
} else {
whites.push(numbers[row][col]);
}
}
}
whites.sort((a, b) => a - b);
blacks.sort((a, b) => a - b);
let whiteCounter = 0;
let blackCounter = 0;
for (let row = x; row < x + w; row++) {
for (let col = y; col < y + w; col++) {
if ((row + col) % 2 === 0) {
numbers[row][col] = blacks[blackCounter];
blackCounter++;
} else {
numbers[row][col] = whites[whiteCounter];
whiteCounter++;
}
}
}
});
return numbers;
}
================================================
FILE: coding_interviews/interviews/google/printSequence/printSequence.js
================================================
/*
number of rows: 4
number of columns: 5
Print this:
1 8 9 16 17
2 7 10 15 18
3 6 11 14 19
4 5 12 13 20
*/
function printSequence(rows, columns) {
const matrix = [];
for (let row = 0; row < rows; row++) {
const matrixRow = [];
for (let col = 0; col < columns; col++) {
if (col % 2 === 0) {
matrixRow.push(col * rows + 1 + row);
} else {
matrixRow.push((col + 1) * rows - row);
}
}
matrix.push(matrixRow);
}
return matrix;
}
console.log(printSequence(4, 5));
console.log(printSequence(6, 6));
================================================
FILE: coding_interviews/interviews/mercari/cumulativeSum.js
================================================
const cumulativeSum = (arr, sum = 0) =>
arr.map((number) => {
sum += number;
return sum;
});
cumulativeSum([1, 3, 5, 7]);
================================================
FILE: coding_interviews/interviews/mercari/findMaxMin.js
================================================
const arr = [1, 2, 3, 4, 100];
const findMaxMin = (arr = []) => {
let min = Infinity;
let max = -Infinity;
arr.forEach((number) => {
if (number < min) min = number;
if (number > max) max = number;
});
return {
min,
max,
};
};
findMaxMin(arr);
================================================
FILE: coding_interviews/interviews/mercari/findSumPairs.js
================================================
let arr = [1, 5, 6, 1, 0, 1];
const findSumPairs = (arr, value) => {
const lookup = {};
const pairs = [];
arr.forEach((number) => {
const target = value - number;
if (lookup[target]) {
pairs.push([number, target]);
}
lookup[number] = true;
});
return pairs;
};
findSumPairs(arr, 6);
================================================
FILE: coding_interviews/interviews/mercari/multipleDupesArray.js
================================================
const arr = [1, 1, 2, 3, 4, 5, 6, 7, 8, 6, 6, 7, 7, 7, 10, 10];
const multipleDupesArray = (arr) => {
const counter = {};
const duplicates = [];
arr.forEach((number) => {
if (number in counter) counter[number]++;
else counter[number] = 1;
});
Object.entries(counter).forEach(([number, count]) => {
if (count > 1) duplicates.push(number);
});
return duplicates;
};
multipleDupesArray(arr);
================================================
FILE: coding_interviews/interviews/mercari/products.js
================================================
// Given the sample response:
// data: {
// items: [
// {
// id: 1,
// name: "Nike Shoes",
// price: 1000,
// status: "on_sale",
// photos: [{ large: 'xxx', thumbnail: 'yyy'}, { large: 'xxx', thumbnail: 'yyy'}]
// verified: true,
// ..
// },
// ...
// ],
// }
// get/items
// 1. Construct a query which includes name, price, photos, & status
// 2. Using the query, bring the data in to RecommendedItems component
// 3. Render the UI for the recommended items list
// 4. Handle loading and error states within the component
import React from 'react';
import useQuery from 'react-query';
const fallBackImg = 'https/....';
const getThumbail = ({ photos }) =>
(photos[0] && photos[0].thumbail) || fallBackImg;
const useItems = (limit) => {
const { data } = useQuery(['items'], fetch(`/items?limit=${limit}`));
return data.map((item) => ({
...item,
thumbnail: getThumbail(item),
}));
};
// items styles
// toCurrency()
function Item({ name, price, thumbnail }) {
return (
<>
<img src={thumbail} alt={name} />
<p>{name}</p>
<p>{toCurrency(price)}</p>
</>
);
}
const WithLoadingErrorAndData = ({ isLoading, isError, children }) => {
if (isLoading) return <Loading />;
if (isError) return <Error />;
return children;
};
// Component
function RecommendedItems({ limit, component }) {
const { data, isLoading, isError } = useItems(limit);
return (
<WithLoadingErrorAndData isLoading={isLoading} isError={isError}>
{data.items.map((item) => (
<Item name={item.name} price={item.price} thumbnail={item.thumbail} />
))}
</WithLoadingErrorAndData>
);
}
================================================
FILE: coding_interviews/interviews/mercari/removeDupes.js
================================================
const arr = [1, 1, 1, 1, 1, 1, 1];
const removeDupes = (arr) => [...new Set(arr)];
removeDupes(arr);
================================================
FILE: coding_interviews/interviews/mercari/retries.js
================================================
/* Implement a retryAsync function that will call an asynchronous function and then
* recall it again on failure until a max number of retries has been reached.
* The function receives the asynchronous function and the maximum number of retries
* The function should return the result of the async function and throw an error
* after the maximum number of retries
*/
// Update the following function
const retryAsync = async (asyncFunc, maxRetries) => {
try {
return await asyncFunc();
} catch (error) {
if (maxRetries > 0) {
return await retryAsync(asyncFunc, maxRetries - 1);
} else {
throw new Error('error');
}
}
};
// Usage Example - DO NOT MODIFY
const main = async () => {
const myPromise = () =>
new Promise((resolve, reject) => {
setTimeout(() => {
reject('Promise Failed');
}, 3000);
});
const res = await retryAsync(myPromise, 3);
return res;
};
main();
================================================
FILE: coding_interviews/interviews/meta/compareLettersInArray/compareLettersInArray.js
================================================
function hasSameLength(words, letters) {
return words.length !== letters.length;
}
function isArray(arr) {
return Array.isArray(arr);
}
function bothArrays(words, letters) {
return isArray(words) && isArray(letters);
}
function compareLettersInArray(words, letters) {
if (hasSameLength(words, letters) || !bothArrays(words, letters)) {
return false;
}
let firstLetterMatches = true;
for (let i = 0; i < words.length; i++) {
if (words[i][0] !== letters[i]) {
firstLetterMatches = false;
break;
}
}
return firstLetterMatches;
}
const words = ['ant', 'bear', 'vulture', 'viper', 'deer'];
const letters = ['a', 'b', 'c', 'd', 'e'];
console.log('answer', compareLettersInArray(words, letters));
console.log('answer', compareLettersInArray(words, ['a', 'b', 'v', 'v', 'd']));
================================================
FILE: coding_interviews/interviews/meta/flatten/flatten.js
================================================
// [1, [2, [ [3, 4], 5], 6]] => [1, 2, 3, 4, 5, 6]
function flatten(arr) {
const flatArray = [];
arr.forEach((element) => {
if (Number.isInteger(element)) {
flatArray.push(element);
} else {
flatArray.push(...flatten(element));
}
});
return flatArray;
}
const flatArray = flatten([1, [2, [[3, 4], 5], 6]]);
console.log(flatArray, [1, 2, 3, 4, 5, 6]);
================================================
FILE: coding_interviews/interviews/meta/flatten/flatten2.js
================================================
// [1, [2, null, true, [ [3, 'NaN', 4, undefined], 5], false, 6, '7']] => [1, 2, 3, 4, 5, 6]
function isString(str) {
return typeof str === 'string' || str instanceof String;
}
function flatten(arr) {
const flatArray = [];
arr.forEach((element) => {
if (Number.isInteger(element)) {
flatArray.push(element);
}
if (element instanceof Array) {
flatArray.push(...flatten(element));
}
if (isString(element)) {
const numberValue = Number(element);
if (Number.isInteger(numberValue)) {
flatArray.push(numberValue);
}
}
});
return flatArray;
}
const flatArray = flatten([
1,
[2, null, true, [[3, 'NaN', 4, undefined], 5], false, 6, '7'],
]);
console.log(flatArray, [1, 2, 3, 4, 5, 6, 7]);
================================================
FILE: coding_interviews/interviews/quintoandar/quinto1.py
================================================
def group_by(parsed_phone, number):
numbers_of_characters = len(parsed_phone)
result_list = []
for i in range(0, numbers_of_characters, number):
result_list.append(parsed_phone[i:i+number])
return result_list
S = "00-44 48 5555 8361"
parsed_phone = S.strip().replace("-", "").replace(" ", "")
numbers_of_characters = len(parsed_phone)
if numbers_of_characters % 3 == 0 || numbers_of_characters % 3 == 2:
return '-'.join(group_by(parsed_phone, 3))
else:
grouped_by_three = group_by(parsed_phone[0:numbers_of_characters-4], 3)
grouped_by_two = group_by(parsed_phone[numbers_of_characters-4:], 2)
return '-'.join(grouped_by_three + grouped_by_two)
================================================
FILE: coding_interviews/interviews/quintoandar/quinto2.py
================================================
A = [0,3,3,7,5,3,11,1]
tuple_a = [(index, el) for index, el in enumerate(A)]
sorted_tuple = sorted(tuple_a, key=lambda x: x[1])
dual = []
for index, el in enumerate(range(len(sorted_tuple) - 1)):
result = (sorted_tuple[index], sorted_tuple[index+1])
dual.append(result)
smaller_distance = 1000000000
for d in dual:
indice1, indice2 = d[0][0], d[1][0]
value1, value2 = d[0][1], d[1][1]
if indice1 < indice2:
if abs(value1 - value2) < smaller_distance:
smaller_distance = abs(value1 - value2)
else:
if abs(value2 - value1) < smaller_distance:
smaller_distance = abs(value2 - value1)
if smaller_distance == 1000000000:
print(-1)
else:
print(smaller_distance)
================================================
FILE: coding_interviews/interviews/quintoandar/quinto3.py
================================================
T = [80, 80, 1000000000, 80, 80, 80, 80, 80, 80, 123456789]
number_of_shares = int(len(T) / 2)
number_of_different_types = len(set
gitextract_w21wx358/ ├── .github/ │ └── workflows/ │ └── push-ci.yml ├── .gitignore ├── .nvmrc ├── .prettierrc ├── .vscode/ │ └── settings.json ├── FUNDING.yml ├── LICENSE ├── README.md ├── big-o.md ├── coding_interviews/ │ ├── README.md │ ├── algoexpert/ │ │ ├── README.md │ │ ├── array-of-products/ │ │ │ ├── array-of-products-optimized.js │ │ │ └── array-of-products.js │ │ ├── best-seat/ │ │ │ └── best-seat.js │ │ ├── binary-search/ │ │ │ └── binary-search.js │ │ ├── branch-sums/ │ │ │ ├── branch-sums-without-recreating-sums.js │ │ │ └── branch-sums.js │ │ ├── bst-construction/ │ │ │ └── bst-construction.js │ │ ├── bst-traversal/ │ │ │ └── bst-traversal.js │ │ ├── bubble-sort/ │ │ │ └── bubble-sort.js │ │ ├── caesar-cipher-encryptor/ │ │ │ └── caesar-cipher-encryptor.js │ │ ├── class-photos/ │ │ │ └── class-photos.js │ │ ├── common-characters/ │ │ │ └── common-characters.js │ │ ├── depth-first-search/ │ │ │ ├── depth-first-search-cleaner.js │ │ │ └── depth-first-search.js │ │ ├── evaluate-expression-tree/ │ │ │ ├── evaluate-expression-tree-cleaner.js │ │ │ ├── evaluate-expression-tree-with-trunc.js │ │ │ └── evaluate-expression-tree.js │ │ ├── find-closest-value-in-bst/ │ │ │ ├── find-closest-value-in-bst-optimized-cleaner.js │ │ │ ├── find-closest-value-in-bst-optimized.js │ │ │ └── find-closest-value-in-bst.js │ │ ├── find-three-largest-numbers/ │ │ │ └── find-three-largest-numbers.js │ │ ├── first-duplicate-value/ │ │ │ ├── first-duplicate-value-optimized.js │ │ │ └── first-duplicate-value.js │ │ ├── first-non-repeating-character/ │ │ │ └── first-non-repeating-character.js │ │ ├── generate-document/ │ │ │ └── generate-document.js │ │ ├── insertion-sort/ │ │ │ └── insertion-sort.js │ │ ├── longest-peak/ │ │ │ └── longest-peak.js │ │ ├── majority-element/ │ │ │ └── majority-element.js │ │ ├── merge-overlapping-intervals/ │ │ │ └── merge-overlapping-intervals.js │ │ ├── middle-node/ │ │ │ ├── middle-node-slow-fast.js │ │ │ └── middle-node.js │ │ ├── minimum-waiting-time/ │ │ │ └── minimum-waiting-time.js │ │ ├── missing-numbers/ │ │ │ └── missing-numbers.js │ │ ├── monotonic-array/ │ │ │ ├── monotonic-array-optimization-1.js │ │ │ ├── monotonic-array-optimization-2.js │ │ │ └── monotonic-array.js │ │ ├── move-element-to-end/ │ │ │ └── move-element-to-end.js │ │ ├── node-depths/ │ │ │ └── node-depths.js │ │ ├── non-constructible-change/ │ │ │ └── non-constructible-change.js │ │ ├── nth-fibonacci/ │ │ │ ├── nth-fibonacci-memo-no-space.js │ │ │ ├── nth-fibonacci-memo.js │ │ │ └── nth-fibonacci.js │ │ ├── optimal-freelancing/ │ │ │ ├── optimal-freelancing-sorting.js │ │ │ └── optimal-freelancing.js │ │ ├── palindrome-check/ │ │ │ └── palindrome-check.js │ │ ├── product-sum/ │ │ │ ├── product-sum-timer-later.js │ │ │ └── product-sum.js │ │ ├── remove-duplicates-from-linked-list/ │ │ │ └── remove-duplicates-from-linked-list.js │ │ ├── remove-islands/ │ │ │ ├── remove-islands-optimized.js │ │ │ └── remove-islands.js │ │ ├── run-length-encoding/ │ │ │ ├── run-length-encoding copy.js │ │ │ ├── run-length-encoding-cleaner.js │ │ │ └── run-length-encoding.js │ │ ├── semordnilap/ │ │ │ └── semordnilap.js │ │ ├── smallest-difference/ │ │ │ └── smallest-difference.js │ │ ├── sorted-squared-array/ │ │ │ ├── sorted-squared-array-insert-position.js │ │ │ ├── sorted-squared-array-two-pointers.js │ │ │ └── sorted-squared-array.js │ │ ├── spiral-traverse/ │ │ │ └── spiral-traverse.js │ │ ├── tandem-bicycle/ │ │ │ ├── tandem-bicycle-cleaner.js │ │ │ └── tandem-bicycle.js │ │ ├── three-number-sum/ │ │ │ └── three-number-sum.js │ │ ├── tournament-winner/ │ │ │ ├── tournament-winner-optimized.js │ │ │ └── tournament-winner.js │ │ ├── transpose-matrix/ │ │ │ └── transpose-matrix.js │ │ ├── two-number-sum/ │ │ │ ├── two-number-sum-optimized.js │ │ │ ├── two-number-sum-two-pointers.js │ │ │ └── two-number-sum.js │ │ ├── validate-bst/ │ │ │ └── validate-bst.js │ │ ├── validate-subsequence/ │ │ │ ├── validate-subsequence-two-pointers.js │ │ │ └── validate-subsequence.js │ │ └── zero-sum-subarray/ │ │ ├── zero-sum-subarray-optimized.js │ │ └── zero-sum-subarray.js │ ├── algorithms_in_python/ │ │ ├── queue/ │ │ │ └── R-6.7.py │ │ └── stack/ │ │ ├── R-6.1.py │ │ ├── R-6.3.py │ │ ├── R-6.4.py │ │ └── R-6.5.py │ ├── blind75/ │ │ └── README.md │ ├── coding_interview_questions/ │ │ ├── common_elements.py │ │ ├── decode-string/ │ │ │ ├── decode-string.js │ │ │ └── tests/ │ │ │ └── decode-string.test.js │ │ ├── mine_swipper.py │ │ ├── most_frequently_occurring.py │ │ ├── non_repeating.py │ │ ├── nth_element_from_the_end.py │ │ ├── one_away_strings.py │ │ ├── optimized_common_elements.py │ │ ├── rotation_array.py │ │ └── two-crystal-balls/ │ │ ├── index.js │ │ └── tests/ │ │ └── index.test.js │ ├── cracking-the-coding-interview/ │ │ ├── README.md │ │ ├── big_o/ │ │ │ ├── aditional1.py │ │ │ ├── aditional2.py │ │ │ ├── aditional3.py │ │ │ ├── aditional4.py │ │ │ ├── aditional5.py │ │ │ ├── aditional6.py │ │ │ ├── example1.py │ │ │ ├── example10.py │ │ │ ├── example11.py │ │ │ ├── example12.py │ │ │ ├── example13.py │ │ │ ├── example14.py │ │ │ ├── example15.py │ │ │ ├── example16.py │ │ │ ├── example2.py │ │ │ ├── example3.py │ │ │ ├── example4.py │ │ │ ├── example5.py │ │ │ ├── example6.py │ │ │ ├── example7.py │ │ │ └── example9.py │ │ └── chapter-001/ │ │ ├── check-permutation/ │ │ │ ├── check-permutation.js │ │ │ └── check-permutation.test.js │ │ ├── cpp/ │ │ │ └── remove_specified_character.cpp │ │ ├── is-unique/ │ │ │ ├── is-unique.js │ │ │ └── is-unique.test.js │ │ ├── one-away/ │ │ │ ├── one-away.js │ │ │ └── one-away.test.js │ │ ├── palindrome-permutation/ │ │ │ ├── palindrome-permutation.js │ │ │ └── palindrome-permutation.test.js │ │ ├── python/ │ │ │ ├── 001.01.py │ │ │ ├── 001.02.py │ │ │ ├── 001.03.py │ │ │ ├── 001.04.py │ │ │ ├── 001.05.py │ │ │ ├── 001.06.py │ │ │ ├── 001.07.py │ │ │ ├── bottlenecks.py │ │ │ └── is_unique.py │ │ ├── string-compression/ │ │ │ └── string-compression.js │ │ └── urlify/ │ │ ├── urlify.js │ │ └── urlify.test.js │ ├── daily_code_problems/ │ │ ├── 001.py │ │ ├── 002.py │ │ ├── 003.py │ │ ├── 004.py │ │ ├── 005.py │ │ ├── 006.py │ │ ├── 007.py │ │ └── README.md │ ├── elements_of_programming_interview/ │ │ ├── array.py │ │ ├── base_conversion.py │ │ ├── buy_and_sell_stock_once.py │ │ ├── can_reach_end.py │ │ ├── delete_duplicates_from_a_sorted_array.py │ │ ├── interconvert_string_and_integer.py │ │ ├── longest_subarray_length_with_same_integers.py │ │ ├── multiply_two_arbitrary_precision_integers.py │ │ └── spreadsheet_column_encoding.py │ ├── hackerrank_interview_prep_kit/ │ │ ├── hash_tables/ │ │ │ ├── count_triplets.py │ │ │ ├── ransom_note.py │ │ │ ├── sherlock_and_anagrams.py │ │ │ └── two_strings.py │ │ └── warmup/ │ │ ├── counting_valleys.py │ │ ├── jumping_on_the_clouds.py │ │ ├── repeated_string.py │ │ └── sales_by_match.py │ ├── interviews/ │ │ ├── fair/ │ │ │ ├── decrementBinaryNumber.js │ │ │ ├── diceTotalScore.js │ │ │ ├── isSubmatrixFull.js │ │ │ └── sortChessSubsquares.js │ │ ├── google/ │ │ │ └── printSequence/ │ │ │ └── printSequence.js │ │ ├── mercari/ │ │ │ ├── cumulativeSum.js │ │ │ ├── findMaxMin.js │ │ │ ├── findSumPairs.js │ │ │ ├── multipleDupesArray.js │ │ │ ├── products.js │ │ │ ├── removeDupes.js │ │ │ └── retries.js │ │ ├── meta/ │ │ │ ├── compareLettersInArray/ │ │ │ │ └── compareLettersInArray.js │ │ │ └── flatten/ │ │ │ ├── flatten.js │ │ │ └── flatten2.js │ │ ├── quintoandar/ │ │ │ ├── quinto1.py │ │ │ ├── quinto2.py │ │ │ ├── quinto3.py │ │ │ └── regions.js │ │ ├── smartnews/ │ │ │ ├── countries.js │ │ │ ├── emiter.js │ │ │ └── getTriplets.js │ │ └── uber/ │ │ ├── longest-words.js │ │ ├── maxFrequency.js │ │ ├── permutations.js │ │ └── tests/ │ │ └── maxFrequency.test.js │ ├── javascript/ │ │ ├── array/ │ │ │ ├── binary-search.js │ │ │ ├── slice.js │ │ │ └── subarrays.js │ │ ├── hashmap/ │ │ │ ├── iteration.js │ │ │ └── object.js │ │ ├── queue/ │ │ │ └── queue.js │ │ ├── stack/ │ │ │ └── stack.js │ │ ├── string/ │ │ │ ├── alphabet.js │ │ │ ├── charCode.js │ │ │ ├── isString.js │ │ │ ├── methods.js │ │ │ └── sort.js │ │ └── tree/ │ │ ├── inorder.js │ │ ├── postorder.js │ │ └── preorder.js │ ├── leetcode/ │ │ ├── easy/ │ │ │ ├── a-number-after-a-double-reversal/ │ │ │ │ ├── a-number-after-a-double-reversal.js │ │ │ │ └── tests/ │ │ │ │ └── a-number-after-a-double-reversal.test.js │ │ │ ├── add-digits/ │ │ │ │ └── add-digits.js │ │ │ ├── add-two-integers/ │ │ │ │ └── index.js │ │ │ ├── alternating-digit-sum/ │ │ │ │ └── alternating-digit-sum.js │ │ │ ├── apply-operations-to-an-array/ │ │ │ │ └── apply-operations-to-an-array.js │ │ │ ├── arithmetic_progression/ │ │ │ │ └── arithmetic_progression.py │ │ │ ├── array_partition.py │ │ │ ├── average-of-levels-in-binary-tree/ │ │ │ │ └── average-of-levels-in-binary-tree.js │ │ │ ├── average-salary-excluding-the-minimum-and-maximum-salary/ │ │ │ │ └── average-salary-excluding-the-minimum-and-maximum-salary.js │ │ │ ├── average-value-of-even-numbers-that-are-divisible-by-three/ │ │ │ │ └── average-value-of-even-numbers-that-are-divisible-by-three.js │ │ │ ├── backspace-string-compare/ │ │ │ │ ├── index.js │ │ │ │ └── tests/ │ │ │ │ └── index.test.js │ │ │ ├── baseball-game/ │ │ │ │ └── baseball-game.js │ │ │ ├── best-poker-hand/ │ │ │ │ └── best-poker-hand.js │ │ │ ├── best-time-to-buy-and-sell-stock/ │ │ │ │ ├── best-time-to-buy-and-sell-stock-tle.js │ │ │ │ └── best-time-to-buy-and-sell-stock.js │ │ │ ├── binary-number-with-alternating-bits/ │ │ │ │ └── binary-number-with-alternating-bits.js │ │ │ ├── binary-search/ │ │ │ │ └── binary-search.js │ │ │ ├── binary-tree-inorder-traversal/ │ │ │ │ └── binary-tree-inorder-traversal.js │ │ │ ├── binary-tree-paths/ │ │ │ │ └── binary-tree-paths.js │ │ │ ├── binary-tree-postorder-traversal/ │ │ │ │ └── binary-tree-postorder-traversal.js │ │ │ ├── binary-tree-preorder-traversal/ │ │ │ │ └── binary-tree-preorder-traversal.js │ │ │ ├── binary-tree-tilt/ │ │ │ │ ├── binary-tree-tilt-optimized.js │ │ │ │ └── binary-tree-tilt.js │ │ │ ├── binary_in_linked_list/ │ │ │ │ └── binary_in_linked_list.py │ │ │ ├── build_an_array_with_stack_operations/ │ │ │ │ └── build_an_array_with_stack_operations.py │ │ │ ├── build_array_from_permutation/ │ │ │ │ └── build_array_from_permutation.js │ │ │ ├── buy-two-chocolates/ │ │ │ │ ├── buy-two-chocolates-on.js │ │ │ │ ├── buy-two-chocolates-sort.js │ │ │ │ └── buy-two-chocolates.js │ │ │ ├── calculate-amount-paid-in-taxes/ │ │ │ │ └── calculate-amount-paid-in-taxes.js │ │ │ ├── calculate-delayed-arrival-time/ │ │ │ │ └── calculate-delayed-arrival-time.js │ │ │ ├── calculate-digit-sum-of-a-string/ │ │ │ │ └── calculate-digit-sum-of-a-string.js │ │ │ ├── calculate-money-in-leetcode-bank/ │ │ │ │ └── calculate-money-in-leetcode-bank.js │ │ │ ├── can-place-flowers/ │ │ │ │ └── can-place-flowers.js │ │ │ ├── capitalize-the-title/ │ │ │ │ └── capitalize-the-title.js │ │ │ ├── cells-in-a-range-on-an-excel-sheet/ │ │ │ │ ├── cells-in-a-range-on-an-excel-sheet.js │ │ │ │ └── tests/ │ │ │ │ └── cells-in-a-range-on-an-excel-sheet.test.js │ │ │ ├── check-array-formation-through-concatenation/ │ │ │ │ └── check-array-formation-through-concatenation.js │ │ │ ├── check-distances-between-same-letters/ │ │ │ │ └── check-distances-between-same-letters.js │ │ │ ├── check-if-a-string-is-an-acronym-of-words/ │ │ │ │ └── check-if-a-string-is-an-acronym-of-words.js │ │ │ ├── check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence/ │ │ │ │ └── check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence.js │ │ │ ├── check-if-all-as-appears-before-all-bs/ │ │ │ │ └── check-if-all-as-appears-before-all-bs.js │ │ │ ├── check-if-matrix-is-x-matrix/ │ │ │ │ └── check-if-matrix-is-x-matrix.js │ │ │ ├── check-if-number-has-equal-digit-count-and-digit-value/ │ │ │ │ └── check-if-number-has-equal-digit-count-and-digit-value.js │ │ │ ├── check-if-numbers-are-ascending-in-a-sentence/ │ │ │ │ └── check-if-numbers-are-ascending-in-a-sentence.js │ │ │ ├── check-if-the-sentence-is-pangram/ │ │ │ │ └── check-if-the-sentence-is-pangram.py │ │ │ ├── check-whether-two-strings-are-almost-equivalent/ │ │ │ │ └── check-whether-two-strings-are-almost-equivalent.js │ │ │ ├── check_if_all_characters_have_equal_number_of_occurrences/ │ │ │ │ └── check_if_all_characters_have_equal_number_of_occurrences.js │ │ │ ├── check_if_two_string_arrays_are_equivalent/ │ │ │ │ └── check_if_two_string_arrays_are_equivalent.py │ │ │ ├── circular-sentence/ │ │ │ │ └── circular-sentence.js │ │ │ ├── climbing-stairs/ │ │ │ │ └── climbing-stairs.js │ │ │ ├── climbing_stairs.py │ │ │ ├── concatenation_of_array/ │ │ │ │ └── concatenation_of_array.js │ │ │ ├── consecutive-characters/ │ │ │ │ └── consecutive-characters.js │ │ │ ├── construct-string-from-binary-tree/ │ │ │ │ └── construct-string-from-binary-tree.js │ │ │ ├── contains-duplicate/ │ │ │ │ ├── contains-duplicate-hashmap.js │ │ │ │ ├── contains-duplicate.js │ │ │ │ └── contains-duplicate.py │ │ │ ├── convert-sorted-array-to-binary-search-tree/ │ │ │ │ └── convert-sorted-array-to-binary-search-tree.js │ │ │ ├── convert-the-temperature/ │ │ │ │ └── convert-the-temperature.js │ │ │ ├── count-asterisks/ │ │ │ │ └── count-asterisks.js │ │ │ ├── count-common-words-with-one-occurrence/ │ │ │ │ └── count-common-words-with-one-occurrence.js │ │ │ ├── count-complete-tree-nodes/ │ │ │ │ └── count-complete-tree-nodes.js │ │ │ ├── count-equal-and-divisible-pairs-in-an-array/ │ │ │ │ ├── count-equal-and-divisible-pairs-in-an-array-2.js │ │ │ │ ├── count-equal-and-divisible-pairs-in-an-array.js │ │ │ │ └── tests/ │ │ │ │ ├── count-equal-and-divisible-pairs-in-an-array-2.test.js │ │ │ │ └── count-equal-and-divisible-pairs-in-an-array.test.js │ │ │ ├── count-good-triplets/ │ │ │ │ └── count-good-triplets.py │ │ │ ├── count-integers-with-even-digit-sum/ │ │ │ │ └── count-integers-with-even-digit-sum.js │ │ │ ├── count-k-difference/ │ │ │ │ └── count-k-difference.js │ │ │ ├── count-largest-group/ │ │ │ │ └── count-largest-group.js │ │ │ ├── count-operations-to-obtain-zero/ │ │ │ │ ├── count-operations-to-obtain-zero.js │ │ │ │ └── tests/ │ │ │ │ └── count-operations-to-obtain-zero.test.js │ │ │ ├── count-pairs-of-similar-strings/ │ │ │ │ └── count-pairs-of-similar-strings.js │ │ │ ├── count-pairs-whose-sum-is-less-than-target/ │ │ │ │ ├── count-pairs-whose-sum-is-less-than-target-two-pointers.js │ │ │ │ └── count-pairs-whose-sum-is-less-than-target.js │ │ │ ├── count-prefixes-of-a-given-string/ │ │ │ │ └── count-prefixes-of-a-given-string.js │ │ │ ├── count-square-sum-triples/ │ │ │ │ └── count-square-sum-triples.js │ │ │ ├── count-symmetric-integers/ │ │ │ │ └── count-symmetric-integers.js │ │ │ ├── count-the-digits-that-divide-a-number/ │ │ │ │ └── count-the-digits-that-divide-a-number.js │ │ │ ├── count-the-number-of-vowel-strings-in-range/ │ │ │ │ └── count-the-number-of-vowel-strings-in-range.js │ │ │ ├── count-vowel-substrings-of-a-string/ │ │ │ │ └── count-vowel-substrings-of-a-string.js │ │ │ ├── count_good_rectangles/ │ │ │ │ └── count_good_rectangles.py │ │ │ ├── count_matches/ │ │ │ │ └── count_matches.py │ │ │ ├── count_of_matches_in_tournament/ │ │ │ │ └── count_of_matches_in_tournament.py │ │ │ ├── count_students/ │ │ │ │ └── count_students.py │ │ │ ├── count_the_number_of_consistent_strings/ │ │ │ │ └── count_the_number_of_consistent_strings.py │ │ │ ├── counting-bits/ │ │ │ │ └── counting-bits.js │ │ │ ├── counting-words-with-a-given-prefix/ │ │ │ │ ├── counting-words-with-a-given-prefix.js │ │ │ │ └── tests/ │ │ │ │ └── counting-words-with-a-given-prefix.test.js │ │ │ ├── crawler-log-folder/ │ │ │ │ └── crawler-log-folder.js │ │ │ ├── create_target_array/ │ │ │ │ └── create_target_array.py │ │ │ ├── decode-the-message/ │ │ │ │ ├── decode-the-message.js │ │ │ │ └── tests/ │ │ │ │ └── decode-the-message.test.js │ │ │ ├── decode_xored_array/ │ │ │ │ └── decode_xored_array.py │ │ │ ├── decompressed_encoded_list/ │ │ │ │ └── decompressed_encoded_list.py │ │ │ ├── decrypt_string/ │ │ │ │ └── decrypt_string.py │ │ │ ├── defanging_an_ip_address/ │ │ │ │ └── defanging_an_ip_address.py │ │ │ ├── defuse-the-bomb/ │ │ │ │ └── defuse-the-bomb.js │ │ │ ├── delete-greatest-value-in-each-row/ │ │ │ │ └── delete-greatest-value-in-each-row.js │ │ │ ├── delete_columns_to_make_sorted/ │ │ │ │ └── delete_columns_to_make_sorted.py │ │ │ ├── design-an-ordered-stream/ │ │ │ │ └── design-an-ordered-stream.js │ │ │ ├── design-hashmap/ │ │ │ │ └── design-hashmap.js │ │ │ ├── design-hashset/ │ │ │ │ └── design-hashset.js │ │ │ ├── design_parking_system/ │ │ │ │ └── design_parking_system.py │ │ │ ├── destination_city/ │ │ │ │ └── destination_city.py │ │ │ ├── detect-capital/ │ │ │ │ └── detect-capital.js │ │ │ ├── determine-if-string-halves-are-alike/ │ │ │ │ └── determine-if-string-halves-are-alike.js │ │ │ ├── determine_color_of_a_chessboard_square/ │ │ │ │ └── determine_color_of_a_chessboard_square.py │ │ │ ├── di_string_match/ │ │ │ │ └── di_string_match.py │ │ │ ├── difference-between-element-sum-and-digit-sum-of-an-array/ │ │ │ │ └── difference-between-element-sum-and-digit-sum-of-an-array.js │ │ │ ├── discount_price/ │ │ │ │ └── discount_price.py │ │ │ ├── distribute-candies-among-children-i/ │ │ │ │ ├── distribute-candies-among-children-i.js │ │ │ │ └── distribute-candies-among-children-ii.js │ │ │ ├── distribute-candies-to-people/ │ │ │ │ └── distribute-candies-to-people.js │ │ │ ├── divide-a-string-into-groups-of-size-k/ │ │ │ │ └── divide-a-string-into-groups-of-size-k.js │ │ │ ├── divide-array-into-equal-pairs/ │ │ │ │ ├── divide-array-into-equal-pairs.js │ │ │ │ └── tests/ │ │ │ │ └── divide-array-into-equal-pairs.test.js │ │ │ ├── divisible-and-non-divisible-sums-difference/ │ │ │ │ └── divisible-and-non-divisible-sums-difference.js │ │ │ ├── divisor-game/ │ │ │ │ └── divisor-game.js │ │ │ ├── equal_reversed_arrays/ │ │ │ │ └── equal_reversed_arrays.py │ │ │ ├── evaluate-boolean-binary-tree/ │ │ │ │ └── evaluate-boolean-binary-tree.js │ │ │ ├── even_digits/ │ │ │ │ └── even_digits.py │ │ │ ├── excel-sheet-column-number/ │ │ │ │ └── excel-sheet-column-number.js │ │ │ ├── fair-candy-swap/ │ │ │ │ ├── fair-candy-swap-optimized.js │ │ │ │ └── fair-candy-swap.js │ │ │ ├── faulty-keyboard/ │ │ │ │ └── faulty-keyboard.js │ │ │ ├── fibonacci_number/ │ │ │ │ └── fibonacci_number.py │ │ │ ├── final-value-after-operations/ │ │ │ │ └── final-value-after-operations.js │ │ │ ├── find-all-k-distant-indices-in-an-array/ │ │ │ │ └── find-all-k-distant-indices-in-an-array.js │ │ │ ├── find-all-numbers-disappeared-in-an-array/ │ │ │ │ └── find-all-numbers-disappeared-in-an-array.js │ │ │ ├── find-center-of-star-graph/ │ │ │ │ └── find-center-of-star-graph.js │ │ │ ├── find-champion-i/ │ │ │ │ ├── find-champion-i-no-map.js │ │ │ │ └── find-champion-i.js │ │ │ ├── find-first-palindromic-string-in-the-array/ │ │ │ │ ├── find-first-palindromic-string-in-the-array.js │ │ │ │ └── tests/ │ │ │ │ └── find-first-palindromic-string-in-the-array.test.js │ │ │ ├── find-greatest-common-divisor-of-array/ │ │ │ │ └── find-greatest-common-divisor-of-array.js │ │ │ ├── find-indices-with-index-and-value-difference-i/ │ │ │ │ └── find-indices-with-index-and-value-difference-i.js │ │ │ ├── find-lucky-integer-in-an-array/ │ │ │ │ └── find-lucky-integer-in-an-array.js │ │ │ ├── find-maximum-number-of-string-pairs/ │ │ │ │ └── find-maximum-number-of-string-pairs.js │ │ │ ├── find-nearest-point-that-has-the-same-x-or-y-coordinate/ │ │ │ │ └── find-nearest-point-that-has-the-same-x-or-y-coordinate.js │ │ │ ├── find-subarrays-with-equal-sum/ │ │ │ │ └── find-subarrays-with-equal-sum.js │ │ │ ├── find-target-indices-after-sorting-array/ │ │ │ │ ├── find-target-indices-after-sorting-array.js │ │ │ │ └── tests/ │ │ │ │ └── find-target-indices-after-sorting-array.test.js │ │ │ ├── find-the-array-concatenation-value/ │ │ │ │ └── find-the-array-concatenation-value.js │ │ │ ├── find-the-difference/ │ │ │ │ └── find-the-difference.js │ │ │ ├── find-the-difference-of-two-arrays/ │ │ │ │ └── find-the-difference-of-two-arrays.js │ │ │ ├── find-the-distance-value-between-two-arrays/ │ │ │ │ └── find-the-distance-value-between-two-arrays.js │ │ │ ├── find-the-distinct-difference-array/ │ │ │ │ ├── find-the-distinct-difference-array.js │ │ │ │ └── optimized-find-the-distinct-difference-array.js │ │ │ ├── find-the-maximum-achievable-number/ │ │ │ │ └── find-the-maximum-achievable-number.js │ │ │ ├── find-the-middle-index-in-array/ │ │ │ │ └── find-the-middle-index-in-array.js │ │ │ ├── find-the-pivot-integer/ │ │ │ │ └── find-the-pivot-integer.js │ │ │ ├── find-the-width-of-columns-of-a-grid/ │ │ │ │ └── find-the-width-of-columns-of-a-grid.js │ │ │ ├── find-words-containing-character/ │ │ │ │ └── find-words-containing-character.js │ │ │ ├── find-words-that-can-be-formed-by-characters/ │ │ │ │ └── find-words-that-can-be-formed-by-characters.js │ │ │ ├── find_common_characters/ │ │ │ │ └── find_common_characters.py │ │ │ ├── find_the_highest_altitude/ │ │ │ │ └── find_the_highest_altitude.py │ │ │ ├── first-bad-version/ │ │ │ │ ├── first-bad-version-binary-search.js │ │ │ │ └── first-bad-version.js │ │ │ ├── first-letter-to-appear-twice/ │ │ │ │ └── first-letter-to-appear-twice.js │ │ │ ├── first-unique-character-in-a-string/ │ │ │ │ └── first-unique-character-in-a-string.js │ │ │ ├── first_bad_version/ │ │ │ │ └── first_bad_version.py │ │ │ ├── fizz-buzz/ │ │ │ │ └── fizz-buzz.js │ │ │ ├── flipping_an_image.py │ │ │ ├── flood-fill/ │ │ │ │ ├── flood-fill-without-visited.js │ │ │ │ └── flood-fill.js │ │ │ ├── furthest-point-from-origin/ │ │ │ │ └── furthest-point-from-origin.js │ │ │ ├── generate_the_string/ │ │ │ │ └── generate_the_string.py │ │ │ ├── goal_parser_interpretation/ │ │ │ │ └── goal_parser_interpretation.py │ │ │ ├── greatest-english-letter-in-upper-and-lower-case/ │ │ │ │ └── greatest-english-letter-in-upper-and-lower-case.js │ │ │ ├── greatest_candies/ │ │ │ │ └── greatest_candies.py │ │ │ ├── guess-number-higher-or-lower/ │ │ │ │ └── guess-number-higher-or-lower.js │ │ │ ├── halves_are_alike/ │ │ │ │ └── halves_are_alike.py │ │ │ ├── hamming_distance/ │ │ │ │ └── hamming_distance.py │ │ │ ├── height_checker/ │ │ │ │ └── height_checker.py │ │ │ ├── implement-queue-using-stacks/ │ │ │ │ └── implement-queue-using-stacks.js │ │ │ ├── implement-stack-using-queues/ │ │ │ │ └── implement-stack-using-queues.js │ │ │ ├── increasing_decreasing_string/ │ │ │ │ └── incresing_decreasin_string.py │ │ │ ├── increasing_order_search_tree/ │ │ │ │ └── increasing_order_search_tree.py │ │ │ ├── intersection-of-multiple-arrays/ │ │ │ │ └── intersection-of-multiple-arrays.js │ │ │ ├── intersection-of-two-arrays-ii/ │ │ │ │ └── intersection-of-two-arrays-ii.js │ │ │ ├── intersection_of_two_arrays/ │ │ │ │ └── intersection_of_two_arrays.py │ │ │ ├── intersection_of_two_arrays_ii/ │ │ │ │ └── intersection_of_two_arrays.py │ │ │ ├── invert-binary-tree/ │ │ │ │ └── invert-binary-tree.js │ │ │ ├── is-subsequence/ │ │ │ │ └── is-subsequence.js │ │ │ ├── is_palindrome.py │ │ │ ├── is_sum_equal/ │ │ │ │ └── is_sum_equal.py │ │ │ ├── island-perimeter/ │ │ │ │ └── island-perimeter.js │ │ │ ├── jewels_and_stones.py │ │ │ ├── judge_route_circle.py │ │ │ ├── judge_route_circle_one_line.py │ │ │ ├── k-items-with-the-maximum-sum/ │ │ │ │ ├── k-items-with-the-maximum-sum-second.js │ │ │ │ └── k-items-with-the-maximum-sum.js │ │ │ ├── keep-multiplying-found-values-by-two/ │ │ │ │ └── keep-multiplying-found-values-by-two.js │ │ │ ├── keyboard-row/ │ │ │ │ └── keyboard-row.js │ │ │ ├── kth-distinct-string-in-an-array/ │ │ │ │ └── kth-distinct-string-in-an-array.js │ │ │ ├── largest-local-values-in-a-matrix/ │ │ │ │ └── largest-local-values-in-a-matrix.js │ │ │ ├── largest-number-after-digit-swaps-by-parity/ │ │ │ │ └── largest-number-after-digit-swaps-by-parity.js │ │ │ ├── largest-positive-integer-that-exists-with-its-negative/ │ │ │ │ └── largest-positive-integer-that-exists-with-its-negative.js │ │ │ ├── last-stone-weight/ │ │ │ │ ├── last-stone-weight.js │ │ │ │ └── tests/ │ │ │ │ └── last-stone-weight.test.js │ │ │ ├── last-visited-integers/ │ │ │ │ └── last-visited-integers.js │ │ │ ├── leaf-similar-trees/ │ │ │ │ └── leaf-similar-trees.js │ │ │ ├── left-and-right-sum-differences/ │ │ │ │ └── left-and-right-sum-differences.js │ │ │ ├── length-of-last-word/ │ │ │ │ └── length-of-last-word.js │ │ │ ├── lexicographically-smallest-palindrome/ │ │ │ │ └── lexicographically-smallest-palindrome.js │ │ │ ├── linked-list-cycle/ │ │ │ │ └── linked-list-cycle.js │ │ │ ├── longer-contiguous-segments-of-ones-than-zeros/ │ │ │ │ └── longer-contiguous-segments-of-ones-than-zeros.js │ │ │ ├── longest-nice-substring/ │ │ │ │ └── longest-nice-substring.js │ │ │ ├── longest-subsequence-with-limited-sum/ │ │ │ │ └── longest-subsequence-with-limited-sum.js │ │ │ ├── longest_palindrome.py │ │ │ ├── lowest-common-ancestor-of-a-binary-search-tree/ │ │ │ │ └── lowest-common-ancestor-of-a-binary-search-tree.js │ │ │ ├── lucky_numbers_in_a_matrix/ │ │ │ │ └── lucky_numbers_in_a_matrix.py │ │ │ ├── majority-element/ │ │ │ │ └── majority-element.js │ │ │ ├── make-array-zero-by-subtracting-equal-amounts/ │ │ │ │ └── make-array-zero-by-subtracting-equal-amounts.js │ │ │ ├── make-the-string-great/ │ │ │ │ └── make-the-string-great.js │ │ │ ├── matrix-cells-in-distance-order/ │ │ │ │ └── matrix-cells-in-distance-order.js │ │ │ ├── matrix_diagonal_sum/ │ │ │ │ └── matrix_diagonal_sum.py │ │ │ ├── matrix_negative_numbers/ │ │ │ │ └── matrix_negative_numbers.py │ │ │ ├── max-consecutive-ones/ │ │ │ │ └── max-consecutive-ones.js │ │ │ ├── maximum-69-number/ │ │ │ │ └── maximum-69-number.js │ │ │ ├── maximum-ascending-subarray-sum/ │ │ │ │ └── maximum-ascending-subarray-sum.js │ │ │ ├── maximum-count-of-positive-integer-and-negative-integer/ │ │ │ │ └── maximum-count-of-positive-integer-and-negative-integer.js │ │ │ ├── maximum-depth-of-binary-tree/ │ │ │ │ ├── maximum-depth-of-binary-tree-2.js │ │ │ │ └── maximum-depth-of-binary-tree.js │ │ │ ├── maximum-depth-of-n-ary-tree/ │ │ │ │ └── maximum-depth-of-n-ary-tree.js │ │ │ ├── maximum-number-of-balloons/ │ │ │ │ └── maximum-number-of-balloons.js │ │ │ ├── maximum-number-of-pairs-in-array/ │ │ │ │ └── maximum-number-of-pairs-in-array.js │ │ │ ├── maximum-odd-binary-number/ │ │ │ │ └── maximum-odd-binary-number.js │ │ │ ├── maximum-subarray/ │ │ │ │ └── maximum-subarray.js │ │ │ ├── maximum-sum-with-exactly-k-elements/ │ │ │ │ └── maximum-sum-with-exactly-k-elements.js │ │ │ ├── maximum-units-on-a-truck/ │ │ │ │ └── maximum-units-on-a-truck.py │ │ │ ├── maximum-value-of-a-string-in-an-array/ │ │ │ │ └── maximum-value-of-a-string-in-an-array.js │ │ │ ├── maximum_nesting_depth_of_the_parentheses/ │ │ │ │ └── maximum_nesting_depth_of_the_parentheses.py │ │ │ ├── maximum_number_of_balls_in_a_box/ │ │ │ │ └── maximum_number_of_balls_in_a_box.py │ │ │ ├── maximum_number_of_words_you_can_type/ │ │ │ │ └── maximum_number_of_words_you_can_type.js │ │ │ ├── maximum_population/ │ │ │ │ └── maximum_population.py │ │ │ ├── maximum_product/ │ │ │ │ └── maximum_product.py │ │ │ ├── maximum_product_difference_between_two_pairs/ │ │ │ │ └── maximum_product_difference_between_two_pairs.js │ │ │ ├── mean-of-array-after-removing-some-elements/ │ │ │ │ └── mean-of-array-after-removing-some-elements.js │ │ │ ├── merge-nodes-in-between-zeros/ │ │ │ │ ├── merge-nodes-in-between-zeros.js │ │ │ │ └── tests/ │ │ │ │ └── merge-nodes-in-between-zeros.test.js │ │ │ ├── merge-similar-items/ │ │ │ │ └── merge-similar-items.js │ │ │ ├── merge-sorted-array/ │ │ │ │ └── merge-sorted-array.js │ │ │ ├── merge-two-2d-arrays-by-summing-values/ │ │ │ │ └── merge-two-2d-arrays-by-summing-values.js │ │ │ ├── merge-two-binary-trees/ │ │ │ │ └── merge-two-binary-trees.js │ │ │ ├── merge-two-sorted-lists/ │ │ │ │ ├── merge-two-sorted-lists.js │ │ │ │ └── tests/ │ │ │ │ └── merge-two-sorted-lists.test.js │ │ │ ├── merge_strings_alternately/ │ │ │ │ └── merge_strings_alternately.py │ │ │ ├── merge_trees.py │ │ │ ├── merge_two_lists.py │ │ │ ├── middle-of-the-linked-list/ │ │ │ │ ├── middle-of-the-linked-list-fast-slow.js │ │ │ │ └── middle-of-the-linked-list.js │ │ │ ├── min-max-game/ │ │ │ │ └── min-max-game.js │ │ │ ├── minimize-string-length/ │ │ │ │ └── minimize-string-length.js │ │ │ ├── minimum-absolute-difference/ │ │ │ │ └── minimum-absolute-difference.js │ │ │ ├── minimum-absolute-difference-in-bst/ │ │ │ │ └── minimum-absolute-difference-in-bst.js │ │ │ ├── minimum-bit-flips-to-convert-number/ │ │ │ │ ├── minimum-bit-flips-to-convert-number.js │ │ │ │ └── tests/ │ │ │ │ └── minimum-bit-flips-to-convert-number.test.js │ │ │ ├── minimum-cost-to-move-chips-to-the-same-position/ │ │ │ │ └── minimum-cost-to-move-chips-to-the-same-position.js │ │ │ ├── minimum-depth-of-binary-tree/ │ │ │ │ └── minimum-depth-of-binary-tree.js │ │ │ ├── minimum-distance-between-bst-nodes/ │ │ │ │ └── minimum-distance-between-bst-nodes.js │ │ │ ├── minimum-number-game/ │ │ │ │ └── minimum-number-game.js │ │ │ ├── minimum-number-of-moves-to-seat-everyone/ │ │ │ │ ├── minimum-number-of-moves-to-seat-everyone.js │ │ │ │ └── tests/ │ │ │ │ └── minimum-number-of-moves-to-seat-everyone.test.js │ │ │ ├── minimum-number-of-operations-to-convert-time/ │ │ │ │ └── minimum-number-of-operations-to-convert-time.js │ │ │ ├── minimum-string-length-after-removing-substrings/ │ │ │ │ └── minimum-string-length-after-removing-substrings.js │ │ │ ├── minimum-subsequence-in-non-increasing-order/ │ │ │ │ └── minimum-subsequence-in-non-increasing-order.js │ │ │ ├── minimum-sum/ │ │ │ │ └── minimum-sum.js │ │ │ ├── minimum-sum-of-mountain-triplets-i/ │ │ │ │ └── minimum-sum-of-mountain-triplets-i.js │ │ │ ├── minimum-time-to-type-word-using-special-typewriter/ │ │ │ │ └── minimum-time-to-type-word-using-special-typewriter.js │ │ │ ├── minimum-value-to-get-positive-step-by-step-sum/ │ │ │ │ └── minimum-value-to-get-positive-step-by-step-sum.js │ │ │ ├── minimum_operations_to_make_the_array_increasing/ │ │ │ │ └── minimum_operations_to_make_the_array_increasing.py │ │ │ ├── missing-number/ │ │ │ │ └── missing-number.js │ │ │ ├── monotonic-array/ │ │ │ │ └── monotonic-array.js │ │ │ ├── most-words-found/ │ │ │ │ └── most-words-found.js │ │ │ ├── move-zeroes/ │ │ │ │ ├── move-zeroes-in-place.js │ │ │ │ └── move-zeroes.js │ │ │ ├── n_ary_tree_postorder_traversal/ │ │ │ │ └── n_ary_tree_postorder_traversal.py │ │ │ ├── n_ary_tree_preorder_traversal/ │ │ │ │ └── n_ary_tree_preorder_traversal.py │ │ │ ├── n_repeated_element_in_size_2n_array/ │ │ │ │ └── n_repeated_element_in_size_2n_array.py │ │ │ ├── neither-minimum-nor-maximum/ │ │ │ │ ├── neither-minimum-nor-maximum-on.js │ │ │ │ └── neither-minimum-nor-maximum.js │ │ │ ├── next-greater-element-i/ │ │ │ │ ├── next-greater-element-i-optimized.js │ │ │ │ ├── next-greater-element-i.js │ │ │ │ └── tests/ │ │ │ │ ├── next-greater-element-i-optimized.test.js │ │ │ │ └── next-greater-element-i.test.js │ │ │ ├── num_unique_emails/ │ │ │ │ └── num_unique_emails.py │ │ │ ├── number-of-1-bits/ │ │ │ │ └── number-of-1-bits.js │ │ │ ├── number-of-arithmetic-triplets/ │ │ │ │ └── number-of-arithmetic-triplets.js │ │ │ ├── number-of-common-factors/ │ │ │ │ └── number-of-common-factors.js │ │ │ ├── number-of-employees-who-met-the-target/ │ │ │ │ └── number-of-employees-who-met-the-target.js │ │ │ ├── number-of-even-and-odd-bits/ │ │ │ │ └── number-of-even-and-odd-bits.js │ │ │ ├── number-of-lines-to-write-string/ │ │ │ │ └── number-of-lines-to-write-string.js │ │ │ ├── number-of-senior-citizens/ │ │ │ │ ├── number-of-senior-citizens.js │ │ │ │ └── one-liner-number-of-senior-citizens.js │ │ │ ├── number-of-strings-that-appear-as-substrings-in-word/ │ │ │ │ └── number-of-strings-that-appear-as-substrings-in-word.js │ │ │ ├── number-of-unequal-triplets-in-array/ │ │ │ │ └── number-of-unequal-triplets-in-array.js │ │ │ ├── number_complement.py │ │ │ ├── number_of_good_pairs/ │ │ │ │ └── number_of_good_pairs.py │ │ │ ├── number_of_recent_calls/ │ │ │ │ └── number_of_recent_calls.py │ │ │ ├── number_of_students/ │ │ │ │ └── number_of_students.py │ │ │ ├── odd-string-difference/ │ │ │ │ └── odd-string-difference.js │ │ │ ├── odd_in_matrix/ │ │ │ │ └── odd_in_matrix.py │ │ │ ├── partition_labels.py │ │ │ ├── pascals-triangle/ │ │ │ │ └── pascals-triangle.js │ │ │ ├── path-sum/ │ │ │ │ └── path-sum.js │ │ │ ├── peak_index_mountain.py │ │ │ ├── percentage-of-letter-in-string/ │ │ │ │ └── percentage-of-letter-in-string.js │ │ │ ├── plus_one/ │ │ │ │ ├── plus_one.js │ │ │ │ └── plus_one.py │ │ │ ├── points-that-intersect-with-cars/ │ │ │ │ └── points-that-intersect-with-cars.js │ │ │ ├── power-of-two/ │ │ │ │ └── power-of-two.js │ │ │ ├── prime-number-of-set-bits-in-binary-representation/ │ │ │ │ └── prime-number-of-set-bits-in-binary-representation.js │ │ │ ├── projection-area-of-3d-shapes/ │ │ │ │ └── projection-area-of-3d-shapes.js │ │ │ ├── range_sum_of_bst/ │ │ │ │ └── range_sum_of_bst.py │ │ │ ├── rank-transform-of-an-array/ │ │ │ │ ├── rank-transform-of-an-array-less-memory.js │ │ │ │ └── rank-transform-of-an-array.js │ │ │ ├── ransom-note/ │ │ │ │ └── ransom-note.js │ │ │ ├── ransom_note/ │ │ │ │ └── ransom_note.py │ │ │ ├── reduce_zero/ │ │ │ │ └── reduce_zero.py │ │ │ ├── reformat-date/ │ │ │ │ └── reformat-date.js │ │ │ ├── reformat-phone-number/ │ │ │ │ └── reformat-phone-number.js │ │ │ ├── relative-ranks/ │ │ │ │ └── relative-ranks.js │ │ │ ├── relative-sort-array/ │ │ │ │ └── relative-sort-array.js │ │ │ ├── remove-duplicates-from-sorted-list/ │ │ │ │ └── remove-duplicates-from-sorted-list.js │ │ │ ├── remove-linked-list-elements/ │ │ │ │ └── remove-linked-list-elements.js │ │ │ ├── remove-outermost-parentheses/ │ │ │ │ ├── remove-outermost-parentheses.js │ │ │ │ └── tests/ │ │ │ │ └── remove-outermost-parentheses.test.js │ │ │ ├── remove-palindromic-subsequences/ │ │ │ │ └── remove-palindromic-subsequences.js │ │ │ ├── remove-trailing-zeros-from-a-string/ │ │ │ │ └── remove-trailing-zeros-from-a-string.js │ │ │ ├── remove_duplicates/ │ │ │ │ └── remove_duplicates.py │ │ │ ├── remove_duplicates.py │ │ │ ├── remove_duplicates_from_list.py │ │ │ ├── remove_element.py │ │ │ ├── replace_digits/ │ │ │ │ └── replace_digits.py │ │ │ ├── replace_elements/ │ │ │ │ └── replace_elements.py │ │ │ ├── reshape-the-matrix/ │ │ │ │ └── reshape-the-matrix.js │ │ │ ├── reverse-linked-list/ │ │ │ │ └── reverse-linked-list.js │ │ │ ├── reverse-only-letters/ │ │ │ │ └── reverse-only-letters.js │ │ │ ├── reverse-prefix-of-word/ │ │ │ │ ├── reverse-prefix-of-word.js │ │ │ │ └── tests/ │ │ │ │ └── reverse-prefix-of-word.test.js │ │ │ ├── reverse-string/ │ │ │ │ ├── reverse-string-in-place.js │ │ │ │ └── reverse-string.js │ │ │ ├── reverse-vowels-of-a-string/ │ │ │ │ └── reverse-vowels-of-a-string.js │ │ │ ├── reverse-words-in-a-string-iii/ │ │ │ │ └── reverse-words-in-a-string-iii.js │ │ │ ├── reverse_integer.py │ │ │ ├── reverse_string.py │ │ │ ├── reverse_vowels.py │ │ │ ├── reverse_words_string.py │ │ │ ├── rings-and-rods/ │ │ │ │ ├── rings-and-rods.js │ │ │ │ └── tests/ │ │ │ │ └── rings-and-rods.test.js │ │ │ ├── root-equals-sum-of-children/ │ │ │ │ └── index.js │ │ │ ├── row-with-maximum-ones/ │ │ │ │ └── row-with-maximum-ones.js │ │ │ ├── running_array_sum/ │ │ │ │ └── running_array_sum.py │ │ │ ├── same-tree/ │ │ │ │ └── same-tree.js │ │ │ ├── same_tree.py │ │ │ ├── search-in-a-binary-search-tree/ │ │ │ │ └── search-in-a-binary-search-tree.js │ │ │ ├── search-insert-position/ │ │ │ │ ├── search-insert-position-new.js │ │ │ │ └── search-insert-position.js │ │ │ ├── search_in_a_binary_search_tree/ │ │ │ │ └── search_in_a_binary_search_tree.py │ │ │ ├── second-largest-digit-in-a-string/ │ │ │ │ └── second-largest-digit-in-a-string.js │ │ │ ├── self_dividing_numbers.py │ │ │ ├── semi-ordered-permutation/ │ │ │ │ └── semi-ordered-permutation.js │ │ │ ├── separate-the-digits-in-an-array/ │ │ │ │ └── separate-the-digits-in-an-array.js │ │ │ ├── shortest_to_char/ │ │ │ │ └── shortest_to_char.py │ │ │ ├── shuffle_string/ │ │ │ │ └── shuffle_string.py │ │ │ ├── shuffle_the_array/ │ │ │ │ └── shuffle_the_array.py │ │ │ ├── sign_of_the_product_of_an_array/ │ │ │ │ └── sign_of_the_product_of_an_array.py │ │ │ ├── single-number/ │ │ │ │ └── single-number.js │ │ │ ├── single_number/ │ │ │ │ └── single_number.py │ │ │ ├── slowest-key/ │ │ │ │ └── slowest-key.js │ │ │ ├── smallest-even-multiple/ │ │ │ │ └── smallest-even-multiple.js │ │ │ ├── smallest-index-with-equal-value/ │ │ │ │ └── smallest-index-with-equal-value.js │ │ │ ├── smallest-range-i/ │ │ │ │ ├── optimized-smallest-range-i.js │ │ │ │ ├── smallest-range-i.js │ │ │ │ └── smallest-range-iI.js │ │ │ ├── smallest_numbers/ │ │ │ │ └── smallest_numbers.py │ │ │ ├── sort-array-by-increasing-frequency/ │ │ │ │ └── sort-array-by-increasing-frequency.js │ │ │ ├── sort-array-by-parity/ │ │ │ │ ├── sort-array-by-parity-two-loops.js │ │ │ │ └── sort-array-by-parity.js │ │ │ ├── sort-array-by-parity-ii/ │ │ │ │ ├── sort-array-by-parity-ii.js │ │ │ │ └── tests/ │ │ │ │ └── sort-array-by-parity-ii.test.js │ │ │ ├── sort-even-and-odd-indices-independently/ │ │ │ │ └── sort-even-and-odd-indices-independently.js │ │ │ ├── sort-integers-by-the-number-of-1-bits/ │ │ │ │ └── sort-integers-by-the-number-of-1-bits.js │ │ │ ├── sort-the-people/ │ │ │ │ └── sort-the-people.js │ │ │ ├── sort_array_by_parity/ │ │ │ │ └── sort_array_by_parity.py │ │ │ ├── sort_sentence/ │ │ │ │ └── sort_sentence.py │ │ │ ├── special-positions-in-a-binary-matrix/ │ │ │ │ ├── special-positions-in-a-binary-matrix-cache.js │ │ │ │ └── special-positions-in-a-binary-matrix.js │ │ │ ├── split-strings-by-separator/ │ │ │ │ └── split-strings-by-separator.js │ │ │ ├── split-with-minimum-sum/ │ │ │ │ └── split-with-minimum-sum.js │ │ │ ├── split_string_in_balanced_strings/ │ │ │ │ └── split_string_in_balanced_strings.py │ │ │ ├── squares-of-a-sorted-array/ │ │ │ │ ├── squares-of-a-sorted-array-on.js │ │ │ │ └── squares-of-a-sorted-array.js │ │ │ ├── squares_of_a_sorted_array/ │ │ │ │ └── squares_of_a_sorted_array.py │ │ │ ├── str_str/ │ │ │ │ └── str_str.py │ │ │ ├── string-matching-in-an-array/ │ │ │ │ └── string-matching-in-an-array.js │ │ │ ├── subarrays-distinct-element-sum-of-squares-i/ │ │ │ │ └── subarrays-distinct-element-sum-of-squares-i.js │ │ │ ├── subdomain_visit_count.py │ │ │ ├── substrings-of-size-three-with-distinct-characters/ │ │ │ │ └── substrings-of-size-three-with-distinct-characters.js │ │ │ ├── subtract_product_and_sum/ │ │ │ │ └── subtract_product_and_sum.py │ │ │ ├── subtree-of-another-tree/ │ │ │ │ └── subtree-of-another-tree.js │ │ │ ├── sum-multiples/ │ │ │ │ └── sum-multiples.js │ │ │ ├── sum-of-all-subset-xor-totals/ │ │ │ │ └── sum-of-all-subset-xor-totals.js │ │ │ ├── sum-of-digits-in-base-k/ │ │ │ │ └── sum-of-digits-in-base-k.js │ │ │ ├── sum-of-digits-of-string-after-convert/ │ │ │ │ └── sum-of-digits-of-string-after-convert.js │ │ │ ├── sum-of-left-leaves/ │ │ │ │ └── sum-of-left-leaves.js │ │ │ ├── sum-of-squares-of-special-elements/ │ │ │ │ └── sum-of-squares-of-special-elements.js │ │ │ ├── sum-of-values-at-indices-with-k-set-bits/ │ │ │ │ └── sum-of-values-at-indices-with-k-set-bits.js │ │ │ ├── sum_leaf_binary_numbers/ │ │ │ │ └── sum_leaf_binary_numbers.py │ │ │ ├── sum_of_all_odd_length_subarrays/ │ │ │ │ └── sum_of_all_odd_length_subarrays.py │ │ │ ├── sum_of_unique_elements/ │ │ │ │ └── sum_of_unique_elements.py │ │ │ ├── sum_zero/ │ │ │ │ └── sum_zero.py │ │ │ ├── symmetric-tree/ │ │ │ │ └── symmetric-tree.js │ │ │ ├── take-gifts-from-the-richest-pile/ │ │ │ │ └── take-gifts-from-the-richest-pile.js │ │ │ ├── three-consecutive-odds/ │ │ │ │ └── three-consecutive-odds.js │ │ │ ├── time-needed-to-buy-tickets/ │ │ │ │ └── time-needed-to-buy-tickets.js │ │ │ ├── to_lower_case/ │ │ │ │ └── to_lower_case.py │ │ │ ├── toeplitz-matrix/ │ │ │ │ └── toeplitz-matrix.js │ │ │ ├── transpose-matrix/ │ │ │ │ └── transpose-matrix.js │ │ │ ├── truncate_sentence/ │ │ │ │ └── truncate_sentence.py │ │ │ ├── two-furthest-houses-with-different-colors/ │ │ │ │ └── two-furthest-houses-with-different-colors.js │ │ │ ├── two-out-of-three/ │ │ │ │ └── two-out-of-three.js │ │ │ ├── two-sum/ │ │ │ │ └── two-sum.js │ │ │ ├── two-sum-iv-input-is-a-bst/ │ │ │ │ └── two-sum-iv-input-is-a-bst.js │ │ │ ├── two_sum.py │ │ │ ├── uncommon-words-from-two-sentences/ │ │ │ │ └── uncommon-words-from-two-sentences.js │ │ │ ├── unique-number-of-occurrences/ │ │ │ │ └── unique-number-of-occurrences.js │ │ │ ├── unique_morse_code_words.py │ │ │ ├── unique_number_of_occurrences/ │ │ │ │ └── unique_number_of_occurrences.py │ │ │ ├── univalued-binary-tree/ │ │ │ │ └── univalued-binary-tree.js │ │ │ ├── valid-anagram/ │ │ │ │ └── valid-anagram.js │ │ │ ├── valid-palindrome/ │ │ │ │ ├── valid-palindrome-2.js │ │ │ │ ├── valid-palindrome.js │ │ │ │ └── valid_palindrome.py │ │ │ ├── valid-parentheses/ │ │ │ │ └── valid-parentheses.js │ │ │ ├── water-bottles/ │ │ │ │ └── water-bottles.js │ │ │ ├── weakest_rows/ │ │ │ │ └── weakest_rows.py │ │ │ └── xor-operation-in-an-array/ │ │ │ └── xor-operation-in-an-array.js │ │ └── medium/ │ │ ├── 3sum/ │ │ │ └── 3sum-tle.js │ │ ├── add_two_numbers/ │ │ │ └── add_two_numbers.py │ │ ├── all_elements_in_two_binary_search_trees/ │ │ │ └── all_elements_in_two_binary_search_trees.py │ │ ├── arithmetic-subarrays/ │ │ │ └── arithmetic-subarrays.py │ │ ├── balance-a-binary-search-tree/ │ │ │ └── balance-a-binary-search-tree.js │ │ ├── binary-tree-inorder-traversal/ │ │ │ └── binary-tree-inorder-traversal.py │ │ ├── binary-tree-level-order-traversal/ │ │ │ └── binary-tree-level-order-traversal.js │ │ ├── bst_from_pre_order_traversal/ │ │ │ └── bst_from_pre_order_traversal.py │ │ ├── bst_to_greatest/ │ │ │ └── bst_to_greatest.py │ │ ├── clone-graph/ │ │ │ └── clone-graph.js │ │ ├── cloned_binary_tree/ │ │ │ └── cloned_binary_tree.py │ │ ├── count-nodes-equal-to-average-of-subtree/ │ │ │ └── count-nodes-equal-to-average-of-subtree.js │ │ ├── count-number-of-distinct-integers-after-reverse-operations/ │ │ │ ├── count-number-of-distinct-integers-after-reverse-operations-numbers.js │ │ │ └── count-number-of-distinct-integers-after-reverse-operations.js │ │ ├── count-sorted-vowel-strings/ │ │ │ └── count-sorted-vowel-strings.js │ │ ├── count-sub-islands/ │ │ │ ├── count-sub-islands-tle.js │ │ │ └── count-sub-islands.js │ │ ├── count_points/ │ │ │ └── count_points.py │ │ ├── counter_number_of_teams/ │ │ │ └── counter_number_of_teams.py │ │ ├── deck_revealed_increasing/ │ │ │ └── deck_revealed_increasing.py │ │ ├── decode-string/ │ │ │ ├── decode-string.js │ │ │ └── tests/ │ │ │ └── decode-string.test.js │ │ ├── deepest_leaves_sum/ │ │ │ └── deepest_leaves_sum.py │ │ ├── delete-node-in-a-linked-list/ │ │ │ ├── better-delete-node-in-a-linked-list.js │ │ │ └── delete-node-in-a-linked-list.js │ │ ├── design-a-stack-with-increment-operation/ │ │ │ ├── design-a-stack-with-increment-operation.js │ │ │ └── tests/ │ │ │ └── design-a-stack-with-increment-operation.test.js │ │ ├── design-add-and-search-words-data-structure/ │ │ │ └── design-add-and-search-words-data-structure.js │ │ ├── difference-between-ones-and-zeros-in-row-and-column/ │ │ │ └── difference-between-ones-and-zeros-in-row-and-column.js │ │ ├── encode_and_decode_tinyurl/ │ │ │ └── encode_and_decode_tinyurl.py │ │ ├── execution-of-all-suffix-instructions-staying-in-a-grid/ │ │ │ └── execution-of-all-suffix-instructions-staying-in-a-grid.js │ │ ├── find-the-original-array-of-prefix-xor/ │ │ │ ├── README.md │ │ │ └── find-the-original-array-of-prefix-xor.js │ │ ├── find-the-winner-of-the-circular-game/ │ │ │ ├── find-the-winner-of-the-circular-game.js │ │ │ └── queue-find-the-winner-of-the-circular-game.js │ │ ├── find-triangular-sum-of-an-array/ │ │ │ ├── find-triangular-sum-of-an-array.js │ │ │ └── tests/ │ │ │ └── find-triangular-sum-of-an-array.test.js │ │ ├── find-valid-matrix-given-row-and-column-sums/ │ │ │ └── find-valid-matrix-given-row-and-column-sums.js │ │ ├── find_and_replace_pattern/ │ │ │ └── find_and_replace_pattern.py │ │ ├── finding_pairs_with_a_certain_sum/ │ │ │ └── finding_pairs_with_a_certain_sum.py │ │ ├── finding_the_users_active_minutes/ │ │ │ └── finding_the_users_active_minutes.py │ │ ├── fraction_to_decimal/ │ │ │ └── fraction_to_decimal.py │ │ ├── group-anagrams/ │ │ │ └── group-anagrams.js │ │ ├── group_the_people/ │ │ │ └── group_the_people.py │ │ ├── insert-greatest-common-divisors-in-linked-list/ │ │ │ └── insert-greatest-common-divisors-in-linked-list.js │ │ ├── insert-into-a-binary-search-tree/ │ │ │ └── insert-into-a-binary-search-tree.js │ │ ├── insert_bst/ │ │ │ └── insert_bst.py │ │ ├── keep_city_skyline/ │ │ │ └── keep_city_skyline.py │ │ ├── kth-smallest-element-in-a-bst/ │ │ │ ├── kth-smallest-element-in-a-bst-1.js │ │ │ ├── kth-smallest-element-in-a-bst-2.js │ │ │ └── kth-smallest-element-in-a-bst.js │ │ ├── letter_tile_possibilities/ │ │ │ └── letter_tile_possibilities.py │ │ ├── longest-substring-without-repeating-characters/ │ │ │ └── longest-substring-without-repeating-characters.js │ │ ├── max-area-of-island/ │ │ │ └── max-area-of-island.js │ │ ├── max_coins/ │ │ │ └── max_coins.py │ │ ├── maximum-sum-of-an-hourglass/ │ │ │ └── maximum-sum-of-an-hourglass.js │ │ ├── maximum_binary_tree/ │ │ │ └── maximum_binary_tree.py │ │ ├── median_tree/ │ │ │ └── median_tree.py │ │ ├── merge-nodes-in-between-zeros/ │ │ │ ├── merge-nodes-in-between-zeros.js │ │ │ └── tests/ │ │ │ └── merge-nodes-in-between-zeros.test.js │ │ ├── min-cost-climbing-stairs/ │ │ │ └── min-cost-climbing-stairs.js │ │ ├── min_operations/ │ │ │ └── min_operations.py │ │ ├── min_pair_sum/ │ │ │ └── min_pair_sum.py │ │ ├── min_partitions/ │ │ │ └── min_partitions.py │ │ ├── minimum-add-to-make-parentheses-valid/ │ │ │ └── minimum-add-to-make-parentheses-valid.js │ │ ├── minimum-amount-of-time-to-collect-garbage/ │ │ │ └── minimum-amount-of-time-to-collect-garbage.js │ │ ├── minimum-cost-of-buying-candies-with-discount/ │ │ │ └── minimum-cost-of-buying-candies-with-discount.js │ │ ├── minimum-number-of-steps-to-make-two-strings-anagram/ │ │ │ ├── README.md │ │ │ └── minimum-number-of-steps-to-make-two-strings-anagram.js │ │ ├── minimum_number_of_operations_to_move_all_balls_to_each_box/ │ │ │ └── minimum_number_of_operations_to_move_all_balls_to_each_box.py │ │ ├── number-of-closed-islands/ │ │ │ └── number-of-closed-islands.js │ │ ├── number-of-enclaves/ │ │ │ └── number-of-enclaves.js │ │ ├── number-of-islands/ │ │ │ └── number-of-islands.js │ │ ├── number-of-laser-beams-in-a-bank/ │ │ │ ├── number-of-laser-beams-in-a-bank.js │ │ │ └── tests/ │ │ │ └── number-of-laser-beams-in-a-bank.test.js │ │ ├── optimal-partition-of-string/ │ │ │ ├── optimal-partition-of-string.js │ │ │ └── optimized-optimal-partition-of-string.js │ │ ├── pair-sum/ │ │ │ ├── pair-sum.js │ │ │ └── tests/ │ │ │ └── pair-sum.test.js │ │ ├── partition-array-according-to-given-pivot/ │ │ │ ├── partition-array-according-to-given-pivot.js │ │ │ └── tests/ │ │ │ └── partition-array-according-to-given-pivot.test.js │ │ ├── permutation-in-string/ │ │ │ ├── permutation-in-string-sliding-window.js │ │ │ └── permutation-in-string.js │ │ ├── populating-next-right-pointers-in-each-node/ │ │ │ ├── populating-next-right-pointers-in-each-node-simpler.js │ │ │ └── populating-next-right-pointers-in-each-node.js │ │ ├── process_queries/ │ │ │ └── process_queries.py │ │ ├── product-of-array-except-self/ │ │ │ └── product-of-array-except-self.js │ │ ├── rearrange-array-elements-by-sign/ │ │ │ ├── rearrange-array-elements-by-sign.js │ │ │ └── tests/ │ │ │ └── rearrange-array-elements-by-sign.test.js │ │ ├── reduce_array_size_to_the_half/ │ │ │ └── reduce_array_size_to_the_half.py │ │ ├── remove-nth-node-from-end-of-list/ │ │ │ ├── remove-nth-node-from-end-of-list-fast-slow.js │ │ │ └── remove-nth-node-from-end-of-list.js │ │ ├── rotate-array/ │ │ │ ├── rotate-array-optimized.js │ │ │ └── rotate-array.js │ │ ├── rotate-image/ │ │ │ └── rotate-image.js │ │ ├── search-a-2d-matrix/ │ │ │ ├── search-a-2d-matrix.js │ │ │ └── search-a-2d-matrix.py │ │ ├── search-a-2d-matrix-ii/ │ │ │ └── search-a-2d-matrix-ii.py │ │ ├── set-matrix-zeroes/ │ │ │ └── set-matrix-zeroes.js │ │ ├── sort-the-students-by-their-kth-score/ │ │ │ └── sort-the-students-by-their-kth-score.js │ │ ├── sort_the_matrix_diagonally/ │ │ │ └── sort_the_matrix_diagonally.py │ │ ├── string-compression/ │ │ │ ├── string-compression-copy.js │ │ │ └── string-compression.js │ │ ├── subrectangle_queries/ │ │ │ └── subrectangle_queries.py │ │ ├── sum_of_nodes/ │ │ │ └── sum_of_nodes.py │ │ ├── two-sum-ii-input-array-is-sorted/ │ │ │ ├── two-sum-ii-input-array-is-sorted-2.js │ │ │ └── two-sum-ii-input-array-is-sorted.js │ │ ├── valid-sudoku/ │ │ │ └── valid-sudoku.js │ │ ├── validate-binary-search-tree/ │ │ │ ├── validate-binary-search-tree-2.js │ │ │ ├── validate-binary-search-tree-almost-right.js │ │ │ └── validate-binary-search-tree.js │ │ └── watering-plants/ │ │ ├── tests/ │ │ │ └── watering-plants.test.js │ │ └── watering-plants.js │ ├── python/ │ │ └── string.py │ └── top-problems/ │ ├── are-anagrams.js │ ├── first-and-last-index.js │ ├── kth-largest.js │ ├── min-sliding-window.js │ └── tests/ │ ├── are-anagrams.test.js │ ├── first-and-last-index.test.js │ └── kth-largest.test.js ├── college/ │ ├── graph/ │ │ └── atoms.py │ └── web/ │ ├── css/ │ │ ├── estilos.css │ │ └── index.html │ ├── index.html │ ├── js.js │ └── loop.js ├── competitive-programming/ │ ├── 4clojure/ │ │ ├── problem01.clj │ │ ├── problem02.clj │ │ ├── problem03.clj │ │ ├── problem04.clj │ │ ├── problem05.clj │ │ ├── problem06.clj │ │ ├── problem07.clj │ │ ├── problem19.clj │ │ └── problem20.clj │ ├── acm-icpc-br/ │ │ ├── regionals_2011/ │ │ │ ├── armstrong.cpp │ │ │ ├── calculadora.cpp │ │ │ ├── cartoes.cpp │ │ │ ├── concurso.cpp │ │ │ ├── coral.cpp │ │ │ ├── elevador.cpp │ │ │ ├── estacionamento.cpp │ │ │ ├── extenso.cpp │ │ │ ├── goldbach.cpp │ │ │ ├── matriz_esparsa.cpp │ │ │ ├── pascal.cpp │ │ │ ├── polinomio.cpp │ │ │ ├── quadrado.cpp │ │ │ └── vagas.cpp │ │ ├── regionals_2017_1/ │ │ │ └── A.cpp │ │ └── regionals_2017_2/ │ │ ├── D.cpp │ │ ├── F.cpp │ │ ├── J.py │ │ └── M.cpp │ ├── codeforces/ │ │ └── div2/ │ │ ├── black_square.cpp │ │ ├── karen_and_morning.cpp │ │ ├── keyboard_layouts.cpp │ │ ├── the_child_and_the_homework.cpp │ │ ├── the_child_and_toy.cpp │ │ └── valera_and_plates.cpp │ ├── exercism/ │ │ ├── clojure/ │ │ │ ├── armstrong-numbers/ │ │ │ │ ├── .exercism/ │ │ │ │ │ └── metadata.json │ │ │ │ ├── .lein-failures │ │ │ │ ├── .lein-repl-history │ │ │ │ ├── README.md │ │ │ │ ├── project.clj │ │ │ │ ├── src/ │ │ │ │ │ └── armstrong_numbers.clj │ │ │ │ ├── target/ │ │ │ │ │ ├── classes/ │ │ │ │ │ │ └── META-INF/ │ │ │ │ │ │ └── maven/ │ │ │ │ │ │ └── armstrong-numbers/ │ │ │ │ │ │ └── armstrong-numbers/ │ │ │ │ │ │ └── pom.properties │ │ │ │ │ └── stale/ │ │ │ │ │ └── leiningen.core.classpath.extract-native-dependencies │ │ │ │ └── test/ │ │ │ │ └── armstrong_numbers_test.clj │ │ │ ├── hello-world/ │ │ │ │ ├── README.md │ │ │ │ ├── project.clj │ │ │ │ ├── src/ │ │ │ │ │ └── hello-world.clj │ │ │ │ └── test/ │ │ │ │ └── hello-world-test.clj │ │ │ └── two-fer/ │ │ │ ├── .exercism/ │ │ │ │ └── metadata.json │ │ │ ├── .lein-failures │ │ │ ├── .nrepl-port │ │ │ ├── README.md │ │ │ ├── project.clj │ │ │ ├── src/ │ │ │ │ └── two_fer.clj │ │ │ ├── target/ │ │ │ │ ├── classes/ │ │ │ │ │ └── META-INF/ │ │ │ │ │ └── maven/ │ │ │ │ │ └── two-fer/ │ │ │ │ │ └── two-fer/ │ │ │ │ │ └── pom.properties │ │ │ │ ├── repl-port │ │ │ │ └── stale/ │ │ │ │ └── leiningen.core.classpath.extract-native-dependencies │ │ │ └── test/ │ │ │ └── two_fer_test.clj │ │ └── javascript/ │ │ ├── allergies.js │ │ ├── collatz-conjecture.js │ │ ├── count-words.js │ │ ├── etl.js │ │ ├── flatten-array.js │ │ ├── gigasecond.js │ │ ├── hello-world.js │ │ ├── leap.js │ │ ├── perfect-numbers.js │ │ ├── phone-number.js │ │ ├── resistor-color.js │ │ ├── resistor-colors.js │ │ ├── reverse-string.js │ │ ├── sublist.js │ │ ├── sum-of-multiples.js │ │ ├── triangle.js │ │ └── two-fer.js │ ├── hacker-rank/ │ │ ├── algorithms/ │ │ │ ├── strings/ │ │ │ │ └── palindrome_index.py │ │ │ └── warmup/ │ │ │ ├── birthday_cake_candles.py │ │ │ └── mini_max_sum.py │ │ ├── cpp/ │ │ │ └── introduction/ │ │ │ ├── angry_professor.cpp │ │ │ ├── arrays_introduction.cpp │ │ │ ├── diagonal_difference.cpp │ │ │ ├── input_and_output.cpp │ │ │ ├── library_fine.cpp │ │ │ ├── plus_minus.cpp │ │ │ ├── staircase.cpp │ │ │ ├── time_conversion.cpp │ │ │ ├── vector_erase.cpp │ │ │ └── vector_sort.cpp │ │ ├── data_structures/ │ │ │ └── trees/ │ │ │ ├── in_order_traversal.py │ │ │ ├── post_order_traversal.py │ │ │ └── pre_order_traversal.py │ │ ├── functional-programming/ │ │ │ ├── array_of_n_elements/ │ │ │ │ ├── array_of_n_elements.clj │ │ │ │ └── array_of_n_elements_without_range.clj │ │ │ ├── basics/ │ │ │ │ ├── hello_world.clj │ │ │ │ ├── hello_world_n_times.clj │ │ │ │ └── solve_me_first.clj │ │ │ ├── eval_ex/ │ │ │ │ └── main.clj │ │ │ ├── filter_array/ │ │ │ │ └── filter_array.clj │ │ │ ├── filter_positions_in_a_list/ │ │ │ │ └── filter_positions_in_a_list.clj │ │ │ ├── list_length/ │ │ │ │ ├── list_length.clj │ │ │ │ └── list_length_reduce.clj │ │ │ ├── list_replication/ │ │ │ │ └── list_replication.clj │ │ │ ├── reverse_a_list/ │ │ │ │ ├── reverse_a_list.clj │ │ │ │ ├── reverse_a_list_into.clj │ │ │ │ └── reverse_a_list_reduce.clj │ │ │ ├── sum_of_odd_elements/ │ │ │ │ └── sum_of_odd_elements.clj │ │ │ └── update_list/ │ │ │ ├── update_list.clj │ │ │ ├── update_list_anonymous.clj │ │ │ ├── update_list_map.clj │ │ │ └── update_list_map_anonymous.clj │ │ └── python/ │ │ ├── basic_data_types/ │ │ │ ├── finding_the_percentage.py │ │ │ ├── lists.py │ │ │ ├── nested_list.py │ │ │ ├── runner_up_score.py │ │ │ └── tuple.py │ │ ├── introduction/ │ │ │ ├── arithmetic_operators.py │ │ │ ├── division.py │ │ │ └── if_else.py │ │ ├── sets/ │ │ │ └── intro_to_sets.py │ │ └── strings/ │ │ ├── find_a_string.py │ │ ├── mutate_string.py │ │ ├── split_and_join.py │ │ ├── string_validators.py │ │ ├── swap_case.py │ │ ├── text_wrap.py │ │ └── whats_your_name.py │ ├── interfatecs/ │ │ ├── 1_2016/ │ │ │ ├── a.cpp │ │ │ ├── b.cpp │ │ │ ├── g.cpp │ │ │ └── i.cpp │ │ └── 1_2018/ │ │ ├── a.cpp │ │ ├── b.cpp │ │ ├── c.cpp │ │ ├── d.py │ │ ├── e.py │ │ ├── f.py │ │ ├── g.cpp │ │ ├── h.cpp │ │ ├── i.py │ │ └── j.cpp │ ├── spoj-br/ │ │ ├── aero.cpp │ │ ├── bafo.cpp │ │ ├── bapostas.cpp │ │ ├── bit.cpp │ │ ├── calcula.cpp │ │ ├── calculadora.cpp │ │ ├── dentista.cpp │ │ ├── desculpa.cpp │ │ ├── eleicoes1.cpp │ │ ├── eleicoes2.cpp │ │ ├── estagio.cpp │ │ ├── fatorial.cpp │ │ ├── feyman.cpp │ │ ├── fliperam.cpp │ │ ├── gangorra.cpp │ │ ├── guardacosta.cpp │ │ ├── impedido.cpp │ │ ├── letra.cpp │ │ ├── loopmusi.cpp │ │ ├── lua.cpp │ │ ├── macaco.cpp │ │ ├── minhoca.cpp │ │ ├── miojo.cpp │ │ ├── obi.cpp │ │ ├── obihanoi.cpp │ │ ├── parprox.cpp │ │ ├── peca.cpp │ │ ├── primo.cpp │ │ ├── rumo9s.cpp │ │ ├── saldo.cpp │ │ ├── saldo13.cpp │ │ ├── sorvete.cpp │ │ ├── sudoku.cpp │ │ ├── telefone.cpp │ │ ├── transporte.cpp │ │ ├── troco13.cpp │ │ ├── vivo.cpp │ │ └── wcw.cpp │ ├── timus/ │ │ └── a+b_problem.cpp │ ├── ucoder/ │ │ ├── armstrong_numbers.cpp │ │ ├── historico_de_comandos.cpp │ │ ├── imperador_cassius.cpp │ │ ├── matriz_esparsa.cpp │ │ ├── obi.cpp │ │ └── tsetse.cpp │ ├── uri/ │ │ ├── 3d_virtual_museum.cpp │ │ ├── a_long_time_ago.cpp │ │ ├── above_average.cpp │ │ ├── above_secundary_diagonal.cpp │ │ ├── above_the_main_diagonal.cpp │ │ ├── abracadabra.cpp │ │ ├── advancing_letters.cpp │ │ ├── age_in_day.cpp │ │ ├── ages.cpp │ │ ├── alarm_clock.cpp │ │ ├── alliteration.cpp │ │ ├── andys_first_dictionary.cpp │ │ ├── angry_ducks.cpp │ │ ├── animal.cpp │ │ ├── approximate_number_of_primes.cpp │ │ ├── area.cpp │ │ ├── area_of_circle.cpp │ │ ├── arranging_tasks.cpp │ │ ├── array_123.cpp │ │ ├── array_change_1.cpp │ │ ├── array_fill_1.cpp │ │ ├── array_fill_2.cpp │ │ ├── array_fill_3.cpp │ │ ├── array_fill_4.cpp │ │ ├── array_hash.cpp │ │ ├── array_replacement_1.cpp │ │ ├── array_selection_1.cpp │ │ ├── as_abas_de_pericles.cpp │ │ ├── ascending_and_descending.cpp │ │ ├── assigning_teams.cpp │ │ ├── automated_checking_machine.cpp │ │ ├── average_1.cpp │ │ ├── average_2.cpp │ │ ├── average_3.cpp │ │ ├── average_speed.cpp │ │ ├── back_to_high_school_physics.cpp │ │ ├── bacteria_1.cpp │ │ ├── banknotes.cpp │ │ ├── banknotes_and_coins.cpp │ │ ├── baskharas_formula.cpp │ │ ├── batmain.cpp │ │ ├── bazinga.cpp │ │ ├── below_the_main_diagonal.cpp │ │ ├── below_the_secundary_diagonal.cpp │ │ ├── bill.cpp │ │ ├── bingo.cpp │ │ ├── bla.cpp │ │ ├── blobs.cpp │ │ ├── bloggo_shotcuts.cpp │ │ ├── bob_conduit.cpp │ │ ├── bodybuilder.cpp │ │ ├── brazil_world_cup.cpp │ │ ├── brazilian_economy.cpp │ │ ├── brick_game.cpp │ │ ├── bubbles_and_bucket.cpp │ │ ├── bubbles_and_bucket_2.cpp │ │ ├── building_houses.cpp │ │ ├── building_walls.cpp │ │ ├── buttlerflies.cpp │ │ ├── c_mais_ou_menos.cpp │ │ ├── caeser_cipher.cpp │ │ ├── cannon.cpp │ │ ├── canteen_queue.cpp │ │ ├── cash_roial.cpp │ │ ├── chinese_whispers.cpp │ │ ├── chirrin_chirrion.cpp │ │ ├── chocolate_factory.cpp │ │ ├── christmas_decoration.cpp │ │ ├── christmas_olympic.cpp │ │ ├── christmas_trapeziums.cpp │ │ ├── christmas_tree.cpp │ │ ├── close_the_doors.cpp │ │ ├── coast_guard.cpp │ │ ├── coffee_machine.cpp │ │ ├── colision.cpp │ │ ├── collectable_cards.cpp │ │ ├── colourful_flowers.cpp │ │ ├── column_in_array.cpp │ │ ├── combiner.cpp │ │ ├── compare_substring.cpp │ │ ├── complete_sequence.cpp │ │ ├── consumption.cpp │ │ ├── contando_ciclos.cpp │ │ ├── contest.cpp │ │ ├── contract_revision.cpp │ │ ├── converting_to_hexadecimal.cpp │ │ ├── coordinates_of_a_point.cpp │ │ ├── correct_colourful_flower.cpp │ │ ├── corrida.cpp │ │ ├── counting_crow.cpp │ │ ├── counting_sheeps.cpp │ │ ├── cutoff_rounder.cpp │ │ ├── cutoff_rounder_2.cpp │ │ ├── dancing_sentence.cpp │ │ ├── dangerous_dive.cpp │ │ ├── dating_online.cpp │ │ ├── deciphering_the_encrypted_card.cpp │ │ ├── delaunay_triangulation.cpp │ │ ├── desafio_de_bino.cpp │ │ ├── detective_watson_1.cpp │ │ ├── detective_watson_2.cpp │ │ ├── diamonds_and_sand.cpp │ │ ├── diet_plan.cpp │ │ ├── difference.cpp │ │ ├── different_digits.cpp │ │ ├── difn.cpp │ │ ├── dijkstra.cpp │ │ ├── discovering_password.cpp │ │ ├── distance.cpp │ │ ├── distance_between_two_points.cpp │ │ ├── dividers.cpp │ │ ├── dividing_x_by_y.cpp │ │ ├── diving.cpp │ │ ├── division_of_nlogonia.cpp │ │ ├── divisors_1.cpp │ │ ├── dracarys.cpp │ │ ├── drought.cpp │ │ ├── easy_difference_dates.cpp │ │ ├── easy_fibonacci.cpp │ │ ├── easy_problem_from_rujia_liu_1.cpp │ │ ├── easy_problem_from_rujia_liu_2.cpp │ │ ├── eletrical_outlet.cpp │ │ ├── encryption.cpp │ │ ├── engine_failure.cpp │ │ ├── erasing_and_winning.cpp │ │ ├── estimating_the_mean.cpp │ │ ├── etiquetas_de_noel.cpp │ │ ├── even_and_odd.cpp │ │ ├── even_between_five_numbers.cpp │ │ ├── even_numbers.cpp │ │ ├── even_or_odd.cpp │ │ ├── even_square.cpp │ │ ├── event.cpp │ │ ├── event_time.cpp │ │ ├── exceeding_z.cpp │ │ ├── exchanging_cards.cpp │ │ ├── experiments.cpp │ │ ├── extremely_basic.cpp │ │ ├── face_2015_free_gift.cpp │ │ ├── factorial.cpp │ │ ├── factorial_again.cpp │ │ ├── factorial_sum.cpp │ │ ├── fake_tickets.cpp │ │ ├── fans_and_ballons.cpp │ │ ├── farm_robot.cpp │ │ ├── fase.cpp │ │ ├── fast_fibonacci.cpp │ │ ├── fast_prime_number.cpp │ │ ├── feedback.cpp │ │ ├── feyman.cpp │ │ ├── fibonacci_again.cpp │ │ ├── fibonacci_array.cpp │ │ ├── fila_do_supermercado.cpp │ │ ├── fire_flowers.cpp │ │ ├── fit_or_dont_fit_1.cpp │ │ ├── fit_or_dont_fit_2.cpp │ │ ├── fixed_password.cpp │ │ ├── flavious_josephus_legend.cpp │ │ ├── flavious_josephus_legend2.cpp │ │ ├── flavious_josephus_legend3.cpp │ │ ├── flowers_flourish_from_france.cpp │ │ ├── football.cpp │ │ ├── frequent_asked_questions.cpp │ │ ├── friends_of_habey.cpp │ │ ├── fuel_spent.cpp │ │ ├── functions.cpp │ │ ├── galopeira.cpp │ │ ├── game_of_the_greatness.cpp │ │ ├── general_exam.cpp │ │ ├── getline_fruits.cpp │ │ ├── getline_one.cpp │ │ ├── getline_three_shoes.cpp │ │ ├── going_to_the_market.cpp │ │ ├── grains_in_a_chess_board.cpp │ │ ├── grenais.cpp │ │ ├── growing_sequences.cpp │ │ ├── guess_what.cpp │ │ ├── guilherme_and_his_kites.cpp │ │ ├── guru_da_sorte.cpp │ │ ├── hailstone_sequences.cpp │ │ ├── hall_of_murderers.cpp │ │ ├── hall_of_murderers_2.cpp │ │ ├── hall_of_murderers_3.cpp │ │ ├── hamekameka.cpp │ │ ├── handball.cpp │ │ ├── hardwood_species.cpp │ │ ├── hash_tables.cpp │ │ ├── hashmat_the_brave_warrior.cpp │ │ ├── hay_points.cpp │ │ ├── he_is_offside!.cpp │ │ ├── head_or_tails.cpp │ │ ├── height.cpp │ │ ├── hello_galaxy.cpp │ │ ├── help!.cpp │ │ ├── help_girafales.cpp │ │ ├── help_seu_madruga.cpp │ │ ├── help_seu_madruga_int.cpp │ │ ├── help_the_federation.cpp │ │ ├── hexagonal_tiles_1.cpp │ │ ├── hexagonal_tiles_2.cpp │ │ ├── hidden_message.cpp │ │ ├── highest_and_position.cpp │ │ ├── hohoho.cpp │ │ ├── honey_reservoir.cpp │ │ ├── hours_and_minutes.cpp │ │ ├── how_easy.cpp │ │ ├── huehue.cpp │ │ ├── i_am_toorg.cpp │ │ ├── ice_statuses.cpp │ │ ├── identifying_tea.cpp │ │ ├── image.cpp │ │ ├── impar_par_roubo.cpp │ │ ├── inferior_area.cpp │ │ ├── inside_out.cpp │ │ ├── international_chat.cpp │ │ ├── internship.cpp │ │ ├── interval.cpp │ │ ├── interval2.cpp │ │ ├── inverse_numbers.cpp │ │ ├── is_triangle.cpp │ │ ├── jetiqui.cpp │ │ ├── jingle_composing.cpp │ │ ├── jogatina_ufpa.cpp │ │ ├── jogo_da_boca.py │ │ ├── jollo.cpp │ │ ├── joulupukki.cpp │ │ ├── jumping_frog.cpp │ │ ├── just_in_time.cpp │ │ ├── justifier.cpp │ │ ├── justifier_2.cpp │ │ ├── kage_bunshin_no_jutsu.cpp │ │ ├── kiloman.cpp │ │ ├── koch_snowflake.cpp │ │ ├── lap.cpp │ │ ├── laser_sculpture.cpp │ │ ├── last_analogimon.cpp │ │ ├── laundry.cpp │ │ ├── leaders_impeachment.cpp │ │ ├── led.cpp │ │ ├── left_area.cpp │ │ ├── libertadores_1.cpp │ │ ├── libertadores_2.cpp │ │ ├── line_in_array.cpp │ │ ├── linear_parking_lot.cpp │ │ ├── little_ant.cpp │ │ ├── little_ducks.py │ │ ├── logical_sequence.cpp │ │ ├── logical_sequence_2.cpp │ │ ├── lost_boots.cpp │ │ ├── lowest_number_and_position.cpp │ │ ├── lu_di_oh.cpp │ │ ├── lucro.cpp │ │ ├── lucro_otimizado.cpp │ │ ├── macpronalts.cpp │ │ ├── maesters_map.cpp │ │ ├── mean_median_problem.cpp │ │ ├── medal_table.cpp │ │ ├── merry_christmaaaas.cpp │ │ ├── mirror_sequence.cpp │ │ ├── mjolnir.cpp │ │ ├── monetary_formatting.cpp │ │ ├── montanha_russa.cpp │ │ ├── month.cpp │ │ ├── moon_phases.cpp │ │ ├── morse.cpp │ │ ├── motoboy.cpp │ │ ├── multiple_of_13.cpp │ │ ├── multiple_reading.cpp │ │ ├── multiples.cpp │ │ ├── multiplication_table.cpp │ │ ├── musical_loop.cpp │ │ ├── name_at_form.cpp │ │ ├── natural_sum.cpp │ │ ├── new_record.cpp │ │ ├── nine.cpp │ │ ├── number_frequence.cpp │ │ ├── obi_uri.cpp │ │ ├── odd_numbers.cpp │ │ ├── og.cpp │ │ ├── one_two_three.cpp │ │ ├── operator_game.cpp │ │ ├── optical_reader.cpp │ │ ├── our_days_are_never_coming_back.cpp │ │ ├── painel_led.cpp │ │ ├── palindrome_game.cpp │ │ ├── pandorgas.cpp │ │ ├── pao_de_queijo_sweeper.cpp │ │ ├── parafusos_e_porcas.cpp │ │ ├── parenthesis_balance.cpp │ │ ├── parity.cpp │ │ ├── pascal_library.cpp │ │ ├── password.cpp │ │ ├── password_validator.cpp │ │ ├── paulas_mathematic_game.cpp │ │ ├── peaks_and_valleys.cpp │ │ ├── pedrinhos_christmas.cpp │ │ ├── pepe.cpp │ │ ├── perfect_number.cpp │ │ ├── phin_bonati.cpp │ │ ├── pizza_pre_bh.cpp │ │ ├── pokemon.cpp │ │ ├── pomekon_collection.cpp │ │ ├── pomekons_battle.cpp │ │ ├── population_increase.cpp │ │ ├── positive_numbers.cpp │ │ ├── positives_and_average.cpp │ │ ├── power_crisis.cpp │ │ ├── preface.cpp │ │ ├── presents.cpp │ │ ├── primary_arithmatic.cpp │ │ ├── prime_number.cpp │ │ ├── pum.cpp │ │ ├── quadrant.cpp │ │ ├── queen.cpp │ │ ├── radares.cpp │ │ ├── rails.cpp │ │ ├── rails_again.cpp │ │ ├── reading_books.cpp │ │ ├── regular_simple_polygon.cpp │ │ ├── remaining2.cpp │ │ ├── removing_letter.cpp │ │ ├── rest_of_a_division.cpp │ │ ├── right_area.cpp │ │ ├── rlj.cpp │ │ ├── robot_instructions.cpp │ │ ├── rock_paper_airstrike.cpp │ │ ├── rock_paper_scissors_lizard_spock.cpp │ │ ├── roman_numerals_for_page_numbers.cpp │ │ ├── rot13.cpp │ │ ├── s_sequence.cpp │ │ ├── s_sequence_2.cpp │ │ ├── salary.cpp │ │ ├── salary_with_bonus.cpp │ │ ├── santas_translator.cpp │ │ ├── scientific_notation.cpp │ │ ├── score_validation.cpp │ │ ├── searching_for_nessy.cpp │ │ ├── searching_subsequences.cpp │ │ ├── selection_test_1.cpp │ │ ├── sequence_ij_1.cpp │ │ ├── sequence_ij_2.cpp │ │ ├── sequence_ij_3.cpp │ │ ├── sequence_ij_4.cpp │ │ ├── sequence_of_numbers_and_sum.cpp │ │ ├── sequence_of_sequence.cpp │ │ ├── seven.cpp │ │ ├── several_scores_with_validation.cpp │ │ ├── short_attendance.cpp │ │ ├── short_story.cpp │ │ ├── simple_calculate.cpp │ │ ├── simple_factorial.cpp │ │ ├── simple_prod.cpp │ │ ├── simple_sort.cpp │ │ ├── simple_sum.cpp │ │ ├── simulator.cpp │ │ ├── six_odd_numbers.cpp │ │ ├── snack.cpp │ │ ├── sort_by_length.cpp │ │ ├── sort_sort_and_sort.cpp │ │ ├── sphere.cpp │ │ ├── spurs_rock.cpp │ │ ├── square_array_4.cpp │ │ ├── square_game.cpp │ │ ├── square_matrix_1.cpp │ │ ├── square_matrix_2.cpp │ │ ├── square_matrix_3.cpp │ │ ├── square_root_of_10.cpp │ │ ├── square_root_of_2.cpp │ │ ├── square_spiral.cpp │ │ ├── squared_and_cubic.cpp │ │ ├── ssn_1.cpp │ │ ├── star_trek.cpp │ │ ├── start_grid.cpp │ │ ├── stick_collector_robot.cpp │ │ ├── sticks_game.cpp │ │ ├── strategy_game.cpp │ │ ├── subprime.cpp │ │ ├── sucessor_par.cpp │ │ ├── sudoku.cpp │ │ ├── sum_of_consecutive_even_numbers.cpp │ │ ├── sum_of_consecutive_odd_numbers_3.cpp │ │ ├── sum_of_consecutive_odd_numbers_I.cpp │ │ ├── sum_of_consecutive_odd_numbers_II.cpp │ │ ├── sum_of_two_squares.cpp │ │ ├── summer_camp.cpp │ │ ├── summing_consecutive_integers.cpp │ │ ├── sunday_morning.cpp │ │ ├── superior_area.cpp │ │ ├── system_of_download.cpp │ │ ├── taxes_of_project.cpp │ │ ├── tda_rational_1.cpp │ │ ├── tda_rational_2.cpp │ │ ├── tell_me_the_frequencies.cpp │ │ ├── the_chosen.cpp │ │ ├── the_force_awakens.cpp │ │ ├── the_greater_one_digit_number.cpp │ │ ├── the_greatest.cpp │ │ ├── the_library_of_mr_severino.cpp │ │ ├── the_motion_picture.cpp │ │ ├── the_pythagorean_theorem.cpp │ │ ├── the_race_of_slugs.cpp │ │ ├── the_return_of_radar.cpp │ │ ├── the_return_of_the_king.cpp │ │ ├── the_square_game.cpp │ │ ├── the_wrath_of_khan.cpp │ │ ├── theons_answer.cpp │ │ ├── threebonacci_sequence.cpp │ │ ├── throwing_cards_away.cpp │ │ ├── time_conversion.cpp │ │ ├── time_zone.cpp │ │ ├── to_care_or_not_to_care.cpp │ │ ├── to_care_or_not_to_care2.cpp │ │ ├── top_n.cpp │ │ ├── tornado.cpp │ │ ├── train_swaping.cpp │ │ ├── tri-du.cpp │ │ ├── triangle.cpp │ │ ├── triangle_types.cpp │ │ ├── triangles.cpp │ │ ├── tribol.cpp │ │ ├── trinomial_triangle.cpp │ │ ├── tshirt2.cpp │ │ ├── tshirts.cpp │ │ ├── tug_of_war.cpp │ │ ├── turma_jb6.cpp │ │ ├── turn_left.cpp │ │ ├── turn_left2.cpp │ │ ├── tustin_and_his_new_die.cpp │ │ ├── twilight_at_portland.cpp │ │ ├── twitting.cpp │ │ ├── two_bills.cpp │ │ ├── type_of_fuel.cpp │ │ ├── upset_fracil.cpp │ │ ├── uri.cpp │ │ ├── vai_na_sort.cpp │ │ ├── variations.cpp │ │ ├── virus.cpp │ │ ├── vitoria_and_her_indecision.cpp │ │ ├── volleyball.cpp │ │ ├── weighted_averages.cpp │ │ ├── welcome_to_the_winter.cpp │ │ ├── wertyu.cpp │ │ ├── where_is_the_marble.cpp │ │ ├── which_triangle.cpp │ │ ├── who_turn_is_it.cpp │ │ ├── wills_message.cpp │ │ ├── world_cup.cpp │ │ ├── zero_means_zero.cpp │ │ └── zero_or_one.cpp │ ├── uva/ │ │ └── 280-vertex.cpp │ └── weekend-code-challenge/ │ ├── 01-object-to-array-of-objects/ │ │ ├── README.md │ │ └── soluition1.js │ ├── 02-my-likes/ │ │ ├── README.md │ │ ├── solution1.js │ │ └── solution2.js │ ├── 03-ch-ch-ch-changes/ │ │ ├── README.md │ │ └── solution.js │ ├── 07-zero-to-hero/ │ │ ├── README.md │ │ └── solution1.js │ ├── 08-first-non-repeat/ │ │ ├── README.md │ │ └── solution1.js │ ├── 09-big-three/ │ │ ├── README.md │ │ ├── solution1.js │ │ └── solution2.js │ ├── 10-get-the-photo/ │ │ ├── README.md │ │ └── solution1.js │ └── 11-threes-a-crowd/ │ ├── README.md │ └── solution1.js ├── computer_science/ │ ├── README.md │ ├── algorithms/ │ │ ├── binary-search/ │ │ │ ├── binary-search.js │ │ │ └── tests/ │ │ │ └── binary-search.test.js │ │ ├── bubble-sort/ │ │ │ ├── bubble-sort.js │ │ │ └── tests/ │ │ │ └── bubble-sort.test.js │ │ ├── dynamic_programming/ │ │ │ ├── factorial.cpp │ │ │ └── fibonacci.cpp │ │ ├── find_kth_element/ │ │ │ └── find_kth_element_1.cpp │ │ ├── graphs/ │ │ │ ├── bfs.cpp │ │ │ └── dfs.cpp │ │ ├── is-prime/ │ │ │ └── is-prime.js │ │ ├── kadane/ │ │ │ └── kadane.js │ │ ├── knapsack/ │ │ │ ├── knapsack1.cpp │ │ │ └── knapsack2.cpp │ │ ├── least_common_multiple/ │ │ │ └── least_common_multiple.cpp │ │ ├── linear-search/ │ │ │ ├── linear-search.js │ │ │ └── tests/ │ │ │ └── linear-search.test.js │ │ ├── maximum_subsequence_sum/ │ │ │ ├── maximum_subsequence_sum_1.cpp │ │ │ └── maximum_subsequence_sum_2.cpp │ │ ├── min_and_max/ │ │ │ └── minimax.cpp │ │ ├── parse_strings/ │ │ │ └── parse_strings.cpp │ │ ├── pointers/ │ │ │ └── pointer.cpp │ │ ├── prime_number/ │ │ │ └── prime_number.cpp │ │ ├── recursion/ │ │ │ ├── fibonacci/ │ │ │ │ ├── fibonacci.c │ │ │ │ └── fibonacci.py │ │ │ ├── log_2.c │ │ │ ├── palindromo.c │ │ │ ├── regua.c │ │ │ ├── reverse.c │ │ │ └── sum.py │ │ ├── reverse-string/ │ │ │ ├── reverse-string-in-place.js │ │ │ ├── reverse-string.js │ │ │ └── tests/ │ │ │ └── reverse-string.test.js │ │ ├── search/ │ │ │ ├── binary_search.cpp │ │ │ ├── binary_search.py │ │ │ ├── recursive_binary_search.py │ │ │ └── sequential_search.py │ │ ├── segment-tree/ │ │ │ └── sum/ │ │ │ └── lazy_update.cpp │ │ ├── sorting/ │ │ │ ├── bubble_sort/ │ │ │ │ ├── bubble_sort.cpp │ │ │ │ ├── bubble_sort.py │ │ │ │ └── test_bubble_sort.py │ │ │ ├── insertion_sort.cpp │ │ │ ├── merge_sort.cpp │ │ │ ├── reverse_insertion_sort.cpp │ │ │ ├── selection_sort.cpp │ │ │ └── string_insertion_sort.cpp │ │ ├── string_to_int/ │ │ │ └── string_to_int.cpp │ │ └── subset/ │ │ └── subset.js │ ├── big_o/ │ │ ├── README.md │ │ ├── example1.py │ │ ├── example10.py │ │ ├── example11.py │ │ ├── example12.py │ │ ├── example13.py │ │ ├── example14.py │ │ ├── example15.py │ │ ├── example16.py │ │ ├── example17.py │ │ ├── example18.py │ │ ├── example19.py │ │ ├── example2.py │ │ ├── example20.py │ │ ├── example21.py │ │ ├── example22.py │ │ ├── example3.py │ │ ├── example4.py │ │ ├── example5.py │ │ ├── example6.py │ │ ├── example7.py │ │ └── example9.py │ └── data_structures/ │ ├── array/ │ │ ├── array.cpp │ │ ├── big_o.py │ │ ├── list.py │ │ └── vectors.cpp │ ├── binary-heap/ │ │ ├── README.md │ │ ├── min-heap.js │ │ └── min-heap.test.js │ ├── binary_search_tree/ │ │ ├── BinarySearchTree/ │ │ │ ├── index.js │ │ │ └── index.test.js │ │ ├── big_o.py │ │ ├── binary_search_tree.py │ │ ├── test_binary_search_tree.py │ │ └── test_node.py │ ├── binary_search_tree_without_node/ │ │ ├── binary_search_tree.py │ │ └── test_binary_search_tree.py │ ├── binary_tree/ │ │ ├── BinaryTree/ │ │ │ ├── index.js │ │ │ └── index.test.js │ │ ├── big_o.py │ │ ├── binary_tree.py │ │ └── test_binary_tree.py │ ├── graph/ │ │ ├── AdjacentListGraph/ │ │ │ ├── AdjacentListGraph.js │ │ │ └── example.js │ │ ├── README.md │ │ ├── adjacency_list.cpp │ │ ├── graph.js │ │ ├── graph.py │ │ └── test_graph.py │ ├── hash_table/ │ │ ├── big_o.py │ │ ├── dictionary.py │ │ └── maps.cpp │ ├── linked_list/ │ │ ├── big-o.js │ │ ├── big_o.py │ │ ├── linked-list.js │ │ ├── linked_list.py │ │ ├── test_linked_list.py │ │ ├── test_node.py │ │ └── tests/ │ │ └── linked-list.test.js │ ├── queue/ │ │ ├── big_o.py │ │ ├── queue.js │ │ ├── queue.py │ │ └── tests/ │ │ └── queue.test.js │ ├── segment_tree/ │ │ ├── frequency.cpp │ │ ├── max.cpp │ │ ├── min.cpp │ │ └── sum.cpp │ ├── set/ │ │ ├── set.js │ │ ├── sets.cpp │ │ └── tests/ │ │ └── set.test.js │ ├── stack/ │ │ ├── deque_api.py │ │ ├── stack.cpp │ │ ├── stack.js │ │ ├── stack.py │ │ ├── stack_class.js │ │ └── stack_closure.js │ └── string/ │ └── strings.cpp ├── package.json ├── problem-solving.md └── system-design.md
Showing preview only (246K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (2409 symbols across 1331 files)
FILE: coding_interviews/algoexpert/array-of-products/array-of-products-optimized.js
function initOutput (line 17) | function initOutput(length) {
function arrayOfProducts (line 27) | function arrayOfProducts(array) {
FILE: coding_interviews/algoexpert/array-of-products/array-of-products.js
function initOutput (line 17) | function initOutput(length) {
function arrayOfProducts (line 27) | function arrayOfProducts(array) {
FILE: coding_interviews/algoexpert/best-seat/best-seat.js
function bestSeat (line 25) | function bestSeat(seats) {
FILE: coding_interviews/algoexpert/binary-search/binary-search.js
function binarySearch (line 4) | function binarySearch(array, target) {
FILE: coding_interviews/algoexpert/branch-sums/branch-sums-without-recreating-sums.js
class BinaryTree (line 4) | class BinaryTree {
method constructor (line 5) | constructor(value) {
function branchSums (line 12) | function branchSums(root) {
FILE: coding_interviews/algoexpert/branch-sums/branch-sums.js
class BinaryTree (line 4) | class BinaryTree {
method constructor (line 5) | constructor(value) {
function branchSums (line 12) | function branchSums(root, sum = 0, sums = []) {
FILE: coding_interviews/algoexpert/bst-construction/bst-construction.js
class BST (line 19) | class BST {
method constructor (line 20) | constructor(value) {
method insert (line 26) | insert(value) {
method contains (line 38) | contains(value) {
method remove (line 54) | remove(value, parent = null) {
method _findSmallestNodeValue (line 103) | _findSmallestNodeValue() {
method _findGreatestNodeValue (line 107) | _findGreatestNodeValue() {
FILE: coding_interviews/algoexpert/bst-traversal/bst-traversal.js
function inOrderTraverse (line 1) | function inOrderTraverse(tree, array) {
function preOrderTraverse (line 9) | function preOrderTraverse(tree, array) {
function postOrderTraverse (line 17) | function postOrderTraverse(tree, array) {
FILE: coding_interviews/algoexpert/bubble-sort/bubble-sort.js
function bubbleSort (line 4) | function bubbleSort(array) {
FILE: coding_interviews/algoexpert/caesar-cipher-encryptor/caesar-cipher-encryptor.js
function getChar (line 4) | function getChar(char, key) {
function caesarCipherEncryptor (line 9) | function caesarCipherEncryptor(string, key) {
FILE: coding_interviews/algoexpert/class-photos/class-photos.js
function classPhotos (line 1) | function classPhotos(redShirtHeights, blueShirtHeights) {
FILE: coding_interviews/algoexpert/common-characters/common-characters.js
function commonCharacters (line 17) | function commonCharacters(strings) {
FILE: coding_interviews/algoexpert/depth-first-search/depth-first-search-cleaner.js
class Node (line 4) | class Node {
method constructor (line 5) | constructor(name) {
method addChild (line 10) | addChild(name) {
method depthFirstSearch (line 15) | depthFirstSearch(array) {
FILE: coding_interviews/algoexpert/depth-first-search/depth-first-search.js
class Node (line 4) | class Node {
method constructor (line 5) | constructor(name) {
method addChild (line 10) | addChild(name) {
method depthFirstSearch (line 15) | depthFirstSearch(array) {
FILE: coding_interviews/algoexpert/evaluate-expression-tree/evaluate-expression-tree-cleaner.js
function evaluateExpressionTree (line 1) | function evaluateExpressionTree({value, left, right}) {
FILE: coding_interviews/algoexpert/evaluate-expression-tree/evaluate-expression-tree-with-trunc.js
function evaluateExpressionTree (line 1) | function evaluateExpressionTree(tree) {
FILE: coding_interviews/algoexpert/evaluate-expression-tree/evaluate-expression-tree.js
function evaluateExpressionTree (line 1) | function evaluateExpressionTree(tree) {
FILE: coding_interviews/algoexpert/find-closest-value-in-bst/find-closest-value-in-bst-optimized-cleaner.js
function abs (line 6) | function abs(value) {
function findClosestValueInBst (line 10) | function findClosestValueInBst(tree, target, closest = Infinity) {
FILE: coding_interviews/algoexpert/find-closest-value-in-bst/find-closest-value-in-bst-optimized.js
function findClosestValueInBst (line 6) | function findClosestValueInBst(tree, target, closestValue = Infinity) {
FILE: coding_interviews/algoexpert/find-closest-value-in-bst/find-closest-value-in-bst.js
function findClosestValueInBst (line 4) | function findClosestValueInBst(tree, target, closestValue = Infinity) {
FILE: coding_interviews/algoexpert/find-three-largest-numbers/find-three-largest-numbers.js
function findThreeLargestNumbers (line 4) | function findThreeLargestNumbers(array) {
FILE: coding_interviews/algoexpert/first-duplicate-value/first-duplicate-value-optimized.js
function firstDuplicateValue (line 18) | function firstDuplicateValue(array) {
FILE: coding_interviews/algoexpert/first-duplicate-value/first-duplicate-value.js
function firstDuplicateValue (line 18) | function firstDuplicateValue(array) {
FILE: coding_interviews/algoexpert/first-non-repeating-character/first-non-repeating-character.js
function firstNonRepeatingCharacter (line 4) | function firstNonRepeatingCharacter(string) {
FILE: coding_interviews/algoexpert/generate-document/generate-document.js
function generateDocument (line 22) | function generateDocument(characters, document) {
FILE: coding_interviews/algoexpert/insertion-sort/insertion-sort.js
function swap (line 4) | function swap(array, i, j) {
function insertionSort (line 10) | function insertionSort(array) {
FILE: coding_interviews/algoexpert/longest-peak/longest-peak.js
function longestPeak (line 20) | function longestPeak(array) {
FILE: coding_interviews/algoexpert/majority-element/majority-element.js
function majorityElement (line 4) | function majorityElement(array) {
FILE: coding_interviews/algoexpert/merge-overlapping-intervals/merge-overlapping-intervals.js
function mergeOverlappingIntervals (line 20) | function mergeOverlappingIntervals(array) {
FILE: coding_interviews/algoexpert/middle-node/middle-node-slow-fast.js
function middleNode (line 4) | function middleNode(linkedList) {
FILE: coding_interviews/algoexpert/middle-node/middle-node.js
function middleNode (line 4) | function middleNode(linkedList) {
FILE: coding_interviews/algoexpert/minimum-waiting-time/minimum-waiting-time.js
function minimumWaitingTime (line 1) | function minimumWaitingTime(queries) {
FILE: coding_interviews/algoexpert/missing-numbers/missing-numbers.js
function missingNumbers (line 4) | function missingNumbers(nums) {
FILE: coding_interviews/algoexpert/monotonic-array/monotonic-array-optimization-1.js
function isMonotonic (line 21) | function isMonotonic(array) {
FILE: coding_interviews/algoexpert/monotonic-array/monotonic-array-optimization-2.js
function isMonotonic (line 21) | function isMonotonic(array) {
FILE: coding_interviews/algoexpert/monotonic-array/monotonic-array.js
function isNonIncreasing (line 21) | function isNonIncreasing(array) {
function isNonDecreasing (line 34) | function isNonDecreasing(array) {
function isMonotonic (line 47) | function isMonotonic(array) {
FILE: coding_interviews/algoexpert/move-element-to-end/move-element-to-end.js
function moveElementToEnd (line 19) | function moveElementToEnd(array, toMove) {
FILE: coding_interviews/algoexpert/node-depths/node-depths.js
function nodeDepths (line 4) | function nodeDepths(root, sum = 0) {
FILE: coding_interviews/algoexpert/non-constructible-change/non-constructible-change.js
function nonConstructibleChange (line 4) | function nonConstructibleChange(coins) {
FILE: coding_interviews/algoexpert/nth-fibonacci/nth-fibonacci-memo-no-space.js
function getNthFib (line 4) | function getNthFib(n) {
FILE: coding_interviews/algoexpert/nth-fibonacci/nth-fibonacci-memo.js
function getNthFib (line 4) | function getNthFib(n) {
FILE: coding_interviews/algoexpert/nth-fibonacci/nth-fibonacci.js
function getNthFib (line 4) | function getNthFib(n) {
FILE: coding_interviews/algoexpert/optimal-freelancing/optimal-freelancing-sorting.js
function sortJobs (line 1) | function sortJobs(jobs) {
function optimalFreelancing (line 9) | function optimalFreelancing(jobs) {
FILE: coding_interviews/algoexpert/optimal-freelancing/optimal-freelancing.js
function optimalFreelancing (line 1) | function optimalFreelancing(jobs) {
FILE: coding_interviews/algoexpert/palindrome-check/palindrome-check.js
function isPalindrome (line 4) | function isPalindrome(string) {
FILE: coding_interviews/algoexpert/product-sum/product-sum-timer-later.js
function productSum (line 4) | function productSum(array, depth = 1) {
FILE: coding_interviews/algoexpert/product-sum/product-sum.js
function productSum (line 4) | function productSum(array, product = 1) {
FILE: coding_interviews/algoexpert/remove-duplicates-from-linked-list/remove-duplicates-from-linked-list.js
function removeDuplicatesFromLinkedList (line 4) | function removeDuplicatesFromLinkedList(linkedList) {
FILE: coding_interviews/algoexpert/remove-islands/remove-islands-optimized.js
function markNonIsland (line 17) | function markNonIsland(matrix, rowIndex, colIndex) {
function removeIslands (line 35) | function removeIslands(matrix) {
FILE: coding_interviews/algoexpert/remove-islands/remove-islands.js
function removeIsland (line 17) | function removeIsland(matrix, rowIndex, colIndex) {
function removeIslands (line 38) | function removeIslands(matrix) {
FILE: coding_interviews/algoexpert/run-length-encoding/run-length-encoding copy.js
function runLengthEncoding (line 1) | function runLengthEncoding(string) {
FILE: coding_interviews/algoexpert/run-length-encoding/run-length-encoding-cleaner.js
function runLengthEncoding (line 1) | function runLengthEncoding(string) {
FILE: coding_interviews/algoexpert/run-length-encoding/run-length-encoding.js
function runLengthEncoding (line 1) | function runLengthEncoding(string) {
FILE: coding_interviews/algoexpert/semordnilap/semordnilap.js
function reverse (line 17) | function reverse(word) {
function semordnilap (line 27) | function semordnilap(words) {
FILE: coding_interviews/algoexpert/smallest-difference/smallest-difference.js
function smallestDifference (line 23) | function smallestDifference(arrayOne, arrayTwo) {
FILE: coding_interviews/algoexpert/sorted-squared-array/sorted-squared-array-insert-position.js
function sortedSquaredArray (line 4) | function sortedSquaredArray(array) {
FILE: coding_interviews/algoexpert/sorted-squared-array/sorted-squared-array-two-pointers.js
function sortedSquaredArray (line 4) | function sortedSquaredArray(array) {
FILE: coding_interviews/algoexpert/sorted-squared-array/sorted-squared-array.js
function sortedSquaredArray (line 4) | function sortedSquaredArray(array) {
FILE: coding_interviews/algoexpert/spiral-traverse/spiral-traverse.js
function spiralTraverse (line 25) | function spiralTraverse(array) {
FILE: coding_interviews/algoexpert/tandem-bicycle/tandem-bicycle-cleaner.js
function getTotalSpeed (line 4) | function getTotalSpeed(redShirtSpeeds, blueShirtSpeeds) {
function tandemBicycle (line 14) | function tandemBicycle(redShirtSpeeds, blueShirtSpeeds, fastest) {
FILE: coding_interviews/algoexpert/tandem-bicycle/tandem-bicycle.js
function getMinimumTotalSpeed (line 4) | function getMinimumTotalSpeed(redShirtSpeeds, blueShirtSpeeds) {
function getMaximumTotalSpeed (line 14) | function getMaximumTotalSpeed(redShirtSpeeds, blueShirtSpeeds) {
function tandemBicycle (line 27) | function tandemBicycle(redShirtSpeeds, blueShirtSpeeds, fastest) {
FILE: coding_interviews/algoexpert/three-number-sum/three-number-sum.js
function sortKey (line 1) | function sortKey(array) {
function threeNumberSum (line 8) | function threeNumberSum(array, targetSum) {
FILE: coding_interviews/algoexpert/tournament-winner/tournament-winner-optimized.js
function tournamentWinner (line 4) | function tournamentWinner(competitions, results) {
FILE: coding_interviews/algoexpert/tournament-winner/tournament-winner.js
function tournamentWinner (line 4) | function tournamentWinner(competitions, results) {
FILE: coding_interviews/algoexpert/transpose-matrix/transpose-matrix.js
function transposeMatrix (line 4) | function transposeMatrix(matrix) {
FILE: coding_interviews/algoexpert/two-number-sum/two-number-sum-optimized.js
function twoNumberSum (line 4) | function twoNumberSum(array, targetSum) {
FILE: coding_interviews/algoexpert/two-number-sum/two-number-sum-two-pointers.js
function twoNumberSum (line 4) | function twoNumberSum(array, targetSum) {
FILE: coding_interviews/algoexpert/two-number-sum/two-number-sum.js
function twoNumberSum (line 4) | function twoNumberSum(array, targetSum) {
FILE: coding_interviews/algoexpert/validate-bst/validate-bst.js
class BST (line 1) | class BST {
method constructor (line 2) | constructor(value) {
function validateBst (line 9) | function validateBst(tree) {
FILE: coding_interviews/algoexpert/validate-subsequence/validate-subsequence-two-pointers.js
function isValidSubsequence (line 4) | function isValidSubsequence(array, sequence) {
FILE: coding_interviews/algoexpert/validate-subsequence/validate-subsequence.js
function isValidSubsequence (line 4) | function isValidSubsequence(array, sequence) {
FILE: coding_interviews/algoexpert/zero-sum-subarray/zero-sum-subarray-optimized.js
function zeroSumSubarray (line 4) | function zeroSumSubarray(nums) {
FILE: coding_interviews/algoexpert/zero-sum-subarray/zero-sum-subarray.js
function zeroSumSubarray (line 4) | function zeroSumSubarray(nums) {
FILE: coding_interviews/algorithms_in_python/queue/R-6.7.py
class Emptiness (line 7) | class Emptiness(Exception):
class Queue (line 11) | class Queue:
method __init__ (line 12) | def __init__(self):
method enqueue (line 15) | def enqueue(self, item):
method dequeue (line 18) | def dequeue(self):
method is_empty (line 24) | def is_empty(self):
method front (line 27) | def front(self):
method back (line 33) | def back(self):
method size (line 39) | def size(self):
FILE: coding_interviews/algorithms_in_python/stack/R-6.1.py
class Emptiness (line 8) | class Emptiness(Exception):
class Stack (line 12) | class Stack:
method __init__ (line 13) | def __init__(self):
method push (line 16) | def push(self, item):
method pop (line 19) | def pop(self):
method is_empty (line 25) | def is_empty(self):
method top (line 28) | def top(self):
method size (line 34) | def size(self):
FILE: coding_interviews/algorithms_in_python/stack/R-6.3.py
class Emptiness (line 7) | class Emptiness(Exception):
class Stack (line 11) | class Stack:
method __init__ (line 12) | def __init__(self):
method push (line 15) | def push(self, item):
method pop (line 18) | def pop(self):
method is_empty (line 24) | def is_empty(self):
method top (line 27) | def top(self):
method size (line 33) | def size(self):
function transfer (line 37) | def transfer(S, T):
FILE: coding_interviews/algorithms_in_python/stack/R-6.4.py
class Emptiness (line 5) | class Emptiness(Exception):
class Stack (line 9) | class Stack:
method __init__ (line 10) | def __init__(self):
method push (line 13) | def push(self, item):
method pop (line 16) | def pop(self):
method is_empty (line 22) | def is_empty(self):
method top (line 25) | def top(self):
method size (line 31) | def size(self):
function remove_all (line 35) | def remove_all(stack):
FILE: coding_interviews/algorithms_in_python/stack/R-6.5.py
class Emptiness (line 6) | class Emptiness(Exception):
class Stack (line 10) | class Stack:
method __init__ (line 11) | def __init__(self):
method push (line 14) | def push(self, item):
method pop (line 17) | def pop(self):
method is_empty (line 23) | def is_empty(self):
method top (line 26) | def top(self):
method size (line 32) | def size(self):
function reverse (line 36) | def reverse(items):
FILE: coding_interviews/coding_interview_questions/common_elements.py
function common_elements (line 1) | def common_elements(list1, list2):
FILE: coding_interviews/coding_interview_questions/decode-string/decode-string.js
function decodeString (line 3) | function decodeString(encodedString) {
FILE: coding_interviews/coding_interview_questions/mine_swipper.py
function update_table_spot (line 8) | def update_table_spot(table, row, col, num_rows, num_cols):
function mine_swipper (line 43) | def mine_swipper(bombs, num_rows, num_cols):
FILE: coding_interviews/coding_interview_questions/most_frequently_occurring.py
function most_frequent (line 1) | def most_frequent(given_list):
FILE: coding_interviews/coding_interview_questions/non_repeating.py
function non_repeating (line 10) | def non_repeating(string):
FILE: coding_interviews/coding_interview_questions/nth_element_from_the_end.py
class Node (line 2) | class Node:
method __init__ (line 3) | def __init__(self, value, next=None):
method __str__ (line 7) | def __str__(self):
function nth_from_last (line 10) | def nth_from_last(head, n):
function linked_list_to_string (line 27) | def linked_list_to_string(head):
FILE: coding_interviews/coding_interview_questions/one_away_strings.py
function handle_different_sized_strings (line 13) | def handle_different_sized_strings(s1, s2):
function handle_same_sized_strings (line 29) | def handle_same_sized_strings(s1, s2):
function is_one_away (line 38) | def is_one_away(s1, s2):
FILE: coding_interviews/coding_interview_questions/optimized_common_elements.py
function common_elements (line 1) | def common_elements(list1, list2):
FILE: coding_interviews/coding_interview_questions/rotation_array.py
function is_rotation (line 17) | def is_rotation(a, b):
FILE: coding_interviews/coding_interview_questions/two-crystal-balls/index.js
function twoCrystalBalls (line 1) | function twoCrystalBalls(breaks) {
FILE: coding_interviews/cracking-the-coding-interview/big_o/aditional1.py
function product (line 1) | def product(a, b):
FILE: coding_interviews/cracking-the-coding-interview/big_o/aditional2.py
function power (line 1) | def power(a, b):
FILE: coding_interviews/cracking-the-coding-interview/big_o/aditional3.py
function mod (line 1) | def mod(a, b):
function mod (line 15) | def mod(a, b):
FILE: coding_interviews/cracking-the-coding-interview/big_o/aditional4.py
function div (line 1) | def div(a, b):
FILE: coding_interviews/cracking-the-coding-interview/big_o/aditional5.py
function sqrt (line 1) | def sqrt(n):
function sqrt_helper (line 4) | def sqrt_helper(n, min, max):
FILE: coding_interviews/cracking-the-coding-interview/big_o/aditional6.py
function square_root (line 3) | def square_root(n):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example1.py
function foo (line 1) | def foo(array):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example10.py
function is_prime (line 3) | def is_prime(num):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example11.py
function factorial (line 1) | def factorial(n):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example12.py
function permutation (line 1) | def permutation(str):
function handle_permutation (line 4) | def handle_permutation(str, prefix):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example13.py
function fib (line 1) | def fib(n):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example14.py
function all_fib (line 1) | def all_fib(n):
function fib (line 5) | def fib(n):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example15.py
function all_fib (line 1) | def all_fib(n):
function fib (line 9) | def fib(n, memo):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example16.py
function powers_of_2 (line 1) | def powers_of_2(n):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example2.py
function print_pairs (line 1) | def print_pairs(array):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example3.py
function print_unordered_pairs (line 1) | def print_unordered_pairs(array):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example4.py
function print_unordered_pairs (line 1) | def print_unordered_pairs(array_a, array_b):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example5.py
function print_unordered_pairs (line 1) | def print_unordered_pairs(array_a, array_b):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example6.py
function reverse (line 1) | def reverse(array):
FILE: coding_interviews/cracking-the-coding-interview/big_o/example9.py
function sum (line 1) | def sum(node):
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/check-permutation/check-permutation.js
function buildCharsMap (line 11) | function buildCharsMap(string) {
function checkPermutation (line 22) | function checkPermutation(s1, s2) {
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/cpp/remove_specified_character.cpp
function main (line 6) | int main() {
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/is-unique/is-unique.js
function isUnique (line 8) | function isUnique(string) {
function isUniqueWithSet (line 23) | function isUniqueWithSet(string) {
function isUniqueWithSetSimplified (line 37) | function isUniqueWithSetSimplified(string) {
function isUniqueNSquare (line 46) | function isUniqueNSquare(string) {
function isUniqueWithoutDS (line 59) | function isUniqueWithoutDS(string) {
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/one-away/one-away.js
function buildCharsCount (line 16) | function buildCharsCount(string) {
function oneAway (line 27) | function oneAway(s1, s2) {
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/palindrome-permutation/palindrome-permutation.js
function isAlpha (line 13) | function isAlpha(char) {
function buildMapOsChars (line 17) | function buildMapOsChars(string) {
function palindromePermutation (line 30) | function palindromePermutation(string) {
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.01.py
function all_unique_characters (line 19) | def all_unique_characters(string):
function all_unique_characters (line 43) | def all_unique_characters(string):
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.02.py
function permutation (line 16) | def permutation(str1, str2):
function permutation (line 35) | def permutation(str1, str2):
function permutation (line 63) | def permutation(str1, str2):
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.03.py
function urlify (line 11) | def urlify(string, length):
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.04.py
function is_even (line 12) | def is_even(number):
function is_even_length (line 16) | def is_even_length(string):
function is_palindrome_permutation (line 20) | def is_palindrome_permutation(string):
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.05.py
function is_two_chars_away (line 16) | def is_two_chars_away(str1, str2):
function number_of_needed_changes (line 20) | def number_of_needed_changes(bigger_str, smaller_str):
function one_away (line 41) | def one_away(str1, str2):
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/001.06.py
function string_compression (line 12) | def string_compression(string):
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/bottlenecks.py
function pairs_of_difference (line 7) | def pairs_of_difference(array, diff):
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/python/is_unique.py
function is_unique_chars_using_dictionary (line 6) | def is_unique_chars_using_dictionary(text):
class Test (line 19) | class Test(unittest.TestCase):
method test_is_unique_chars (line 35) | def test_is_unique_chars(self):
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/string-compression/string-compression.js
function compress (line 6) | function compress(chars) {
FILE: coding_interviews/cracking-the-coding-interview/chapter-001/urlify/urlify.js
function urlify (line 8) | function urlify(string, length, placeholder = '%20') {
function urlifyForward (line 33) | function urlifyForward(string, length, placeholder = '%20') {
FILE: coding_interviews/daily_code_problems/001.py
function found_sum_of_two_numbers_brute_force (line 8) | def found_sum_of_two_numbers_brute_force(k, numbers):
function found_sum_of_two_numbers (line 17) | def found_sum_of_two_numbers(k, numbers):
function test_algorithm (line 33) | def test_algorithm(k, numbers):
FILE: coding_interviews/daily_code_problems/002.py
function product_with_exception (line 14) | def product_with_exception(integers):
function test_product_with_exception (line 19) | def test_product_with_exception(integers, result):
FILE: coding_interviews/daily_code_problems/003.py
class Node (line 26) | class Node:
method __init__ (line 27) | def __init__(self, val, left=None, right=None):
function serialize (line 33) | def serialize(node):
function deserialize_node (line 40) | def deserialize_node(nodes):
function create_nodes_queue (line 52) | def create_nodes_queue(string):
function deserialize (line 62) | def deserialize(string):
function pre_order (line 68) | def pre_order(tree):
FILE: coding_interviews/daily_code_problems/004.py
function get_lowest (line 14) | def get_lowest(lowest, present_numbers):
function lowest_positive_integer (line 21) | def lowest_positive_integer(numbers):
FILE: coding_interviews/daily_code_problems/005.py
function cons (line 19) | def cons(a, b):
function list_pair (line 26) | def list_pair(a, b):
function car (line 30) | def car(pair):
function cdr (line 35) | def cdr(pair):
FILE: coding_interviews/daily_code_problems/007.py
function count_decoded_possibilities (line 11) | def count_decoded_possibilities(encoded_message):
FILE: coding_interviews/elements_of_programming_interview/array.py
function even_before_odd (line 5) | def even_before_odd(numbers):
FILE: coding_interviews/elements_of_programming_interview/base_conversion.py
function to_num_representation (line 28) | def to_num_representation(num):
function base_conversion (line 34) | def base_conversion(string_num, base1, base2):
FILE: coding_interviews/elements_of_programming_interview/buy_and_sell_stock_once.py
function buy_and_sell_stock_once (line 3) | def buy_and_sell_stock_once(prices):
FILE: coding_interviews/elements_of_programming_interview/can_reach_end.py
function can_reach_end (line 15) | def can_reach_end(board_game):
FILE: coding_interviews/elements_of_programming_interview/delete_duplicates_from_a_sorted_array.py
function delete_duplicates (line 30) | def delete_duplicates(numbers):
function test (line 51) | def test(input, expect):
function delete_duplicates_2 (line 59) | def delete_duplicates_2(numbers):
function test_2 (line 77) | def test_2(input, expect):
FILE: coding_interviews/elements_of_programming_interview/interconvert_string_and_integer.py
function to_int (line 8) | def to_int(string):
function to_string (line 33) | def to_string(integer):
FILE: coding_interviews/elements_of_programming_interview/longest_subarray_length_with_same_integers.py
function longest_subarray_length_with_same_integers (line 6) | def longest_subarray_length_with_same_integers(numbers):
FILE: coding_interviews/elements_of_programming_interview/multiply_two_arbitrary_precision_integers.py
function multiply_two_arbitrary_precision_integers (line 16) | def multiply_two_arbitrary_precision_integers(int1, int2):
FILE: coding_interviews/elements_of_programming_interview/spreadsheet_column_encoding.py
function spreadcheet_column_encoding (line 30) | def spreadcheet_column_encoding(encoding):
FILE: coding_interviews/hackerrank_interview_prep_kit/hash_tables/count_triplets.py
function count_triplets (line 13) | def count_triplets(arr, r):
FILE: coding_interviews/hackerrank_interview_prep_kit/hash_tables/ransom_note.py
function build_word_counter (line 11) | def build_word_counter(magazine):
function check_notes_on_magazine (line 22) | def check_notes_on_magazine(word_counter, note):
function check_magazine (line 32) | def check_magazine(magazine, note):
FILE: coding_interviews/hackerrank_interview_prep_kit/hash_tables/sherlock_and_anagrams.py
function sherlock_and_anagrams (line 3) | def sherlock_and_anagrams(s):
FILE: coding_interviews/hackerrank_interview_prep_kit/hash_tables/two_strings.py
function two_strings (line 11) | def two_strings(s1, s2):
FILE: coding_interviews/hackerrank_interview_prep_kit/warmup/counting_valleys.py
function counting_valleys (line 11) | def counting_valleys(steps, path):
FILE: coding_interviews/hackerrank_interview_prep_kit/warmup/jumping_on_the_clouds.py
function won_the_game (line 11) | def won_the_game(current, end_game):
function is_cumulus (line 14) | def is_cumulus(cloud):
function jumping_on_clouds (line 17) | def jumping_on_clouds(c):
FILE: coding_interviews/hackerrank_interview_prep_kit/warmup/repeated_string.py
function repeatedString (line 19) | def repeatedString(s, n):
FILE: coding_interviews/hackerrank_interview_prep_kit/warmup/sales_by_match.py
function sock_merchant (line 11) | def sock_merchant(n, ar):
FILE: coding_interviews/interviews/fair/decrementBinaryNumber.js
function countOnes (line 1) | function countOnes(number) {
function toBinary (line 11) | function toBinary(number) {
function toDecimal (line 15) | function toDecimal(number) {
function decrementBinary (line 19) | function decrementBinary(number) {
function decrementBinaryNumber (line 23) | function decrementBinaryNumber(number, requests) {
FILE: coding_interviews/interviews/fair/diceTotalScore.js
function diceTotalScore (line 1) | function diceTotalScore(a, b, c) {
FILE: coding_interviews/interviews/fair/isSubmatrixFull.js
function isSubmatrixFull (line 1) | function isSubmatrixFull(numbers) {
FILE: coding_interviews/interviews/fair/sortChessSubsquares.js
function sortChessSubsquares (line 1) | function sortChessSubsquares(numbers, queries) {
FILE: coding_interviews/interviews/google/printSequence/printSequence.js
function printSequence (line 12) | function printSequence(rows, columns) {
FILE: coding_interviews/interviews/mercari/products.js
function Item (line 45) | function Item({ name, price, thumbnail }) {
function RecommendedItems (line 64) | function RecommendedItems({ limit, component }) {
FILE: coding_interviews/interviews/meta/compareLettersInArray/compareLettersInArray.js
function hasSameLength (line 1) | function hasSameLength(words, letters) {
function isArray (line 5) | function isArray(arr) {
function bothArrays (line 9) | function bothArrays(words, letters) {
function compareLettersInArray (line 13) | function compareLettersInArray(words, letters) {
FILE: coding_interviews/interviews/meta/flatten/flatten.js
function flatten (line 3) | function flatten(arr) {
FILE: coding_interviews/interviews/meta/flatten/flatten2.js
function isString (line 3) | function isString(str) {
function flatten (line 7) | function flatten(arr) {
FILE: coding_interviews/interviews/quintoandar/quinto1.py
function group_by (line 1) | def group_by(parsed_phone, number):
FILE: coding_interviews/interviews/smartnews/countries.js
function solution (line 1) | function solution(A) {
function buildCountriesMapper (line 16) | function buildCountriesMapper(A) {
function verifyCountry (line 32) | function verifyCountry(A, country, row, col, countries) {
FILE: coding_interviews/interviews/smartnews/emiter.js
class EventEmiter (line 8) | class EventEmiter {
method on (line 11) | on(eventName, fn) {
method emit (line 19) | emit(eventName, ...args) {
method off (line 31) | off(eventName, fn) {
method once (line 39) | once(eventName, fn) {
FILE: coding_interviews/interviews/uber/longest-words.js
function buildCounter (line 23) | function buildCounter(letters) {
function getLongestWords (line 37) | function getLongestWords(words, letters) {
FILE: coding_interviews/interviews/uber/maxFrequency.js
function maxFrequency (line 1) | function maxFrequency(numbers) {
FILE: coding_interviews/interviews/uber/permutations.js
function combine (line 30) | function combine(permutations, chars) {
function permutations (line 42) | function permutations(numbers) {
FILE: coding_interviews/javascript/array/binary-search.js
function getMiddle (line 1) | function getMiddle(start, end) {
function binarySearch (line 5) | function binarySearch(numbers, target) {
function logResult (line 23) | function logResult(list, target) {
FILE: coding_interviews/javascript/array/subarrays.js
function generateSubarrays (line 1) | function generateSubarrays(arr, start, end, result) {
FILE: coding_interviews/javascript/queue/queue.js
function push (line 3) | function push(queue, value) {
function pop (line 7) | function pop(queue) {
function front (line 11) | function front(queue) {
function isEmpty (line 15) | function isEmpty(queue) {
FILE: coding_interviews/javascript/stack/stack.js
function push (line 3) | function push(stack, value) {
function pop (line 7) | function pop(stack) {
function top (line 11) | function top(stack) {
function isEmpty (line 15) | function isEmpty(stack) {
FILE: coding_interviews/javascript/string/alphabet.js
function getIndexFromChar (line 10) | function getIndexFromChar(char) {
FILE: coding_interviews/javascript/string/isString.js
function isString (line 1) | function isString(str) {
FILE: coding_interviews/javascript/string/sort.js
function sort (line 1) | function sort(string) {
FILE: coding_interviews/javascript/tree/inorder.js
function inorder (line 9) | function inorder(node) {
FILE: coding_interviews/javascript/tree/postorder.js
function postorder (line 9) | function postorder(node) {
FILE: coding_interviews/javascript/tree/preorder.js
function preorder (line 9) | function preorder(node) {
FILE: coding_interviews/leetcode/easy/a-number-after-a-double-reversal/a-number-after-a-double-reversal.js
function reverse (line 1) | function reverse(numString) {
function removeLeadingZeros (line 11) | function removeLeadingZeros(numString) {
function isSameAfterReversals (line 30) | function isSameAfterReversals(num) {
FILE: coding_interviews/leetcode/easy/add-digits/add-digits.js
function isSingleDigit (line 15) | function isSingleDigit(number) {
function addDigits (line 19) | function addDigits(number) {
FILE: coding_interviews/leetcode/easy/alternating-digit-sum/alternating-digit-sum.js
function isEvent (line 1) | function isEvent(num) {
function alternateDigitSum (line 5) | function alternateDigitSum(n) {
FILE: coding_interviews/leetcode/easy/apply-operations-to-an-array/apply-operations-to-an-array.js
function applyOperations (line 1) | function applyOperations(nums) {
FILE: coding_interviews/leetcode/easy/arithmetic_progression/arithmetic_progression.py
function can_make_arithmetic_progression (line 4) | def can_make_arithmetic_progression(arr):
FILE: coding_interviews/leetcode/easy/array_partition.py
function array_pair_sum (line 8) | def array_pair_sum(nums):
FILE: coding_interviews/leetcode/easy/average-of-levels-in-binary-tree/average-of-levels-in-binary-tree.js
function averageOfLevels (line 1) | function averageOfLevels(root) {
FILE: coding_interviews/leetcode/easy/average-salary-excluding-the-minimum-and-maximum-salary/average-salary-excluding-the-minimum-and-maximum-salary.js
function average (line 1) | function average(salaries) {
FILE: coding_interviews/leetcode/easy/average-value-of-even-numbers-that-are-divisible-by-three/average-value-of-even-numbers-that-are-divisible-by-three.js
function isEven (line 3) | function isEven(num) {
function isDividedBy3 (line 7) | function isDividedBy3(num) {
function averageValue (line 11) | function averageValue(nums) {
FILE: coding_interviews/leetcode/easy/backspace-string-compare/index.js
function buildStack (line 1) | function buildStack(string) {
function isEqual (line 15) | function isEqual(stack1, stack2) {
function backspaceCompare (line 29) | function backspaceCompare(s, t) {
FILE: coding_interviews/leetcode/easy/baseball-game/baseball-game.js
function calPoints (line 1) | function calPoints(ops) {
FILE: coding_interviews/leetcode/easy/best-poker-hand/best-poker-hand.js
function buildMap (line 3) | function buildMap(list) {
function bestHand (line 14) | function bestHand(ranks, suits) {
FILE: coding_interviews/leetcode/easy/best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock-tle.js
function maxProfit (line 1) | function maxProfit(prices) {
FILE: coding_interviews/leetcode/easy/best-time-to-buy-and-sell-stock/best-time-to-buy-and-sell-stock.js
function maxProfit (line 1) | function maxProfit(prices) {
FILE: coding_interviews/leetcode/easy/binary-number-with-alternating-bits/binary-number-with-alternating-bits.js
function toBinary (line 1) | function toBinary(n) {
function isAlternating (line 12) | function isAlternating(binary) {
function hasAlternatingBits (line 24) | function hasAlternatingBits(n) {
FILE: coding_interviews/leetcode/easy/binary-search/binary-search.js
function search (line 1) | function search(nums, target) {
FILE: coding_interviews/leetcode/easy/binary-tree-inorder-traversal/binary-tree-inorder-traversal.js
function inorderTraversal (line 1) | function inorderTraversal(root) {
FILE: coding_interviews/leetcode/easy/binary-tree-paths/binary-tree-paths.js
function traversal (line 1) | function traversal(node, paths, path) {
function binaryTreePaths (line 15) | function binaryTreePaths(root) {
FILE: coding_interviews/leetcode/easy/binary-tree-postorder-traversal/binary-tree-postorder-traversal.js
function postorderTraversal (line 1) | function postorderTraversal(root) {
FILE: coding_interviews/leetcode/easy/binary-tree-preorder-traversal/binary-tree-preorder-traversal.js
function preorderTraversal (line 1) | function preorderTraversal(root) {
FILE: coding_interviews/leetcode/easy/binary-tree-tilt/binary-tree-tilt-optimized.js
function sumNodes (line 14) | function sumNodes(node) {
function findTilt (line 25) | function findTilt(root) {
FILE: coding_interviews/leetcode/easy/binary-tree-tilt/binary-tree-tilt.js
function sumNodes (line 12) | function sumNodes(node) {
function findTilt (line 17) | function findTilt(root) {
FILE: coding_interviews/leetcode/easy/binary_in_linked_list/binary_in_linked_list.py
function get_decimal_value (line 1) | def get_decimal_value(head):
FILE: coding_interviews/leetcode/easy/build_an_array_with_stack_operations/build_an_array_with_stack_operations.py
function build_array (line 3) | def build_array(target, n):
function build_array (line 21) | def build_array(target, n):
FILE: coding_interviews/leetcode/easy/buy-two-chocolates/buy-two-chocolates-on.js
function buyChoco (line 3) | function buyChoco(prices, money) {
FILE: coding_interviews/leetcode/easy/buy-two-chocolates/buy-two-chocolates-sort.js
function buyChoco (line 3) | function buyChoco(prices, money) {
FILE: coding_interviews/leetcode/easy/buy-two-chocolates/buy-two-chocolates.js
function buyChocolate (line 3) | function buyChocolate(prices, money) {
function buyChoco (line 18) | function buyChoco(prices, money) {
FILE: coding_interviews/leetcode/easy/calculate-amount-paid-in-taxes/calculate-amount-paid-in-taxes.js
function calculateTax (line 3) | function calculateTax(brackets, income) {
FILE: coding_interviews/leetcode/easy/calculate-delayed-arrival-time/calculate-delayed-arrival-time.js
function findDelayedArrivalTime (line 3) | function findDelayedArrivalTime(arrivalTime, delayedTime) {
FILE: coding_interviews/leetcode/easy/calculate-digit-sum-of-a-string/calculate-digit-sum-of-a-string.js
function buildSubsets (line 1) | function buildSubsets(s, k) {
function sumDigits (line 11) | function sumDigits(digits) {
function sumDigitsOfSubsets (line 21) | function sumDigitsOfSubsets(subsets) {
function digitSum (line 25) | function digitSum(s, k) {
FILE: coding_interviews/leetcode/easy/calculate-money-in-leetcode-bank/calculate-money-in-leetcode-bank.js
function totalMoney (line 1) | function totalMoney(n) {
FILE: coding_interviews/leetcode/easy/can-place-flowers/can-place-flowers.js
function canPlaceFlowers (line 1) | function canPlaceFlowers(flowerbed, n) {
FILE: coding_interviews/leetcode/easy/capitalize-the-title/capitalize-the-title.js
function isUppercase (line 1) | function isUppercase(char) {
function isLowercase (line 5) | function isLowercase(char) {
function capitalizeChar (line 9) | function capitalizeChar(char) {
function lowercaseChar (line 13) | function lowercaseChar(char) {
function capitalize (line 17) | function capitalize(string) {
function lowercase (line 21) | function lowercase(string) {
function parse (line 25) | function parse(string) {
function capitalizeTitle (line 29) | function capitalizeTitle(title) {
FILE: coding_interviews/leetcode/easy/cells-in-a-range-on-an-excel-sheet/cells-in-a-range-on-an-excel-sheet.js
function cellsInRange (line 3) | function cellsInRange(s) {
FILE: coding_interviews/leetcode/easy/check-array-formation-through-concatenation/check-array-formation-through-concatenation.js
function buildMap (line 1) | function buildMap(pieces) {
function canFormArray (line 11) | function canFormArray(arr, pieces) {
FILE: coding_interviews/leetcode/easy/check-distances-between-same-letters/check-distances-between-same-letters.js
function getDistanceIndex (line 1) | function getDistanceIndex(char) {
function checkDistances (line 5) | function checkDistances(string, distance) {
FILE: coding_interviews/leetcode/easy/check-if-a-string-is-an-acronym-of-words/check-if-a-string-is-an-acronym-of-words.js
function isAcronym (line 3) | function isAcronym(words, s) {
FILE: coding_interviews/leetcode/easy/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence.js
function hasPrefix (line 1) | function hasPrefix(word, searchWord) {
function isPrefixOfWord (line 11) | function isPrefixOfWord(sentence, searchWord) {
FILE: coding_interviews/leetcode/easy/check-if-all-as-appears-before-all-bs/check-if-all-as-appears-before-all-bs.js
function checkString (line 1) | function checkString(s) {
FILE: coding_interviews/leetcode/easy/check-if-matrix-is-x-matrix/check-if-matrix-is-x-matrix.js
function isInGrid (line 1) | function isInGrid(grid, row, col) {
constant DIAGONAL (line 5) | const DIAGONAL = -1;
function getDiagonalFromLeftToRight (line 7) | function getDiagonalFromLeftToRight(grid) {
function getDiagonalFromRightToLeft (line 22) | function getDiagonalFromRightToLeft(grid) {
function isDiagonalNonZero (line 40) | function isDiagonalNonZero(diagonal) {
function isOtherZero (line 44) | function isOtherZero(grid) {
function checkXMatrix (line 56) | function checkXMatrix(grid) {
function checkXMatrix (line 72) | function checkXMatrix(grid) {
FILE: coding_interviews/leetcode/easy/check-if-number-has-equal-digit-count-and-digit-value/check-if-number-has-equal-digit-count-and-digit-value.js
function digitCount (line 1) | function digitCount(num) {
FILE: coding_interviews/leetcode/easy/check-if-numbers-are-ascending-in-a-sentence/check-if-numbers-are-ascending-in-a-sentence.js
function getNumbers (line 1) | function getNumbers(string) {
function isIncreasing (line 7) | function isIncreasing(numbers) {
function areNumbersAscending (line 15) | function areNumbersAscending(string) {
FILE: coding_interviews/leetcode/easy/check-if-the-sentence-is-pangram/check-if-the-sentence-is-pangram.py
function check_if_pangram (line 3) | def check_if_pangram(sentence):
function check_if_pangram (line 13) | def check_if_pangram(sentence):
FILE: coding_interviews/leetcode/easy/check-whether-two-strings-are-almost-equivalent/check-whether-two-strings-are-almost-equivalent.js
function createCounter (line 1) | function createCounter(word) {
function isSimilar (line 12) | function isSimilar(word, counter1, counter2) {
function checkAlmostEquivalent (line 22) | function checkAlmostEquivalent(word1, word2) {
FILE: coding_interviews/leetcode/easy/check_if_two_string_arrays_are_equivalent/check_if_two_string_arrays_are_equivalent.py
function array_strings_are_equal (line 4) | def array_strings_are_equal(word1, word2):
FILE: coding_interviews/leetcode/easy/circular-sentence/circular-sentence.js
function isCircularSentence (line 1) | function isCircularSentence(sentence) {
FILE: coding_interviews/leetcode/easy/climbing-stairs/climbing-stairs.js
function climbStairs (line 1) | function climbStairs(n) {
FILE: coding_interviews/leetcode/easy/climbing_stairs.py
function climb_stairs (line 3) | def climb_stairs(n):
FILE: coding_interviews/leetcode/easy/consecutive-characters/consecutive-characters.js
function maxPower (line 1) | function maxPower(string) {
FILE: coding_interviews/leetcode/easy/construct-string-from-binary-tree/construct-string-from-binary-tree.js
function tree2str (line 15) | function tree2str(root) {
FILE: coding_interviews/leetcode/easy/contains-duplicate/contains-duplicate-hashmap.js
function containsDuplicate (line 11) | function containsDuplicate(nums) {
FILE: coding_interviews/leetcode/easy/contains-duplicate/contains-duplicate.js
function containsDuplicate (line 1) | function containsDuplicate(nums) {
FILE: coding_interviews/leetcode/easy/contains-duplicate/contains-duplicate.py
function contains_nearby_duplicate (line 3) | def contains_nearby_duplicate(nums, k):
function contains_nearby_duplicate (line 11) | def contains_nearby_duplicate(nums, k):
FILE: coding_interviews/leetcode/easy/convert-sorted-array-to-binary-search-tree/convert-sorted-array-to-binary-search-tree.js
function sortedArrayToBST (line 1) | function sortedArrayToBST(nums) {
FILE: coding_interviews/leetcode/easy/convert-the-temperature/convert-the-temperature.js
function convertTemperature (line 1) | function convertTemperature(celsius) {
FILE: coding_interviews/leetcode/easy/count-asterisks/count-asterisks.js
function toggleCanCount (line 1) | function toggleCanCount(canCount) {
function countAsterisks (line 5) | function countAsterisks(s) {
FILE: coding_interviews/leetcode/easy/count-common-words-with-one-occurrence/count-common-words-with-one-occurrence.js
function buildHashmap (line 1) | function buildHashmap(words) {
function countWords (line 15) | function countWords(words1, words2) {
FILE: coding_interviews/leetcode/easy/count-complete-tree-nodes/count-complete-tree-nodes.js
function countNodes (line 11) | function countNodes(node) {
FILE: coding_interviews/leetcode/easy/count-equal-and-divisible-pairs-in-an-array/count-equal-and-divisible-pairs-in-an-array-2.js
function countPairs (line 17) | function countPairs(numbers, k) {
FILE: coding_interviews/leetcode/easy/count-equal-and-divisible-pairs-in-an-array/count-equal-and-divisible-pairs-in-an-array.js
function countPairs (line 17) | function countPairs(numbers, k) {
FILE: coding_interviews/leetcode/easy/count-good-triplets/count-good-triplets.py
function count_good_triplets (line 8) | def count_good_triplets(arr, a, b, c):
FILE: coding_interviews/leetcode/easy/count-integers-with-even-digit-sum/count-integers-with-even-digit-sum.js
function sumDigits (line 1) | function sumDigits(numString) {
function isEven (line 11) | function isEven(num) {
function countEven (line 15) | function countEven(num) {
FILE: coding_interviews/leetcode/easy/count-k-difference/count-k-difference.js
function countKDifference (line 32) | function countKDifference(nums, k) {
FILE: coding_interviews/leetcode/easy/count-largest-group/count-largest-group.js
function sumDigits (line 3) | function sumDigits(num) {
function countLargestGroup (line 14) | function countLargestGroup(n) {
FILE: coding_interviews/leetcode/easy/count-operations-to-obtain-zero/count-operations-to-obtain-zero.js
function countOperations (line 1) | function countOperations(num1, num2) {
FILE: coding_interviews/leetcode/easy/count-pairs-of-similar-strings/count-pairs-of-similar-strings.js
function buildCharsMap (line 1) | function buildCharsMap(word) {
function hasAllChars (line 12) | function hasAllChars(word, charsMap) {
function isSimilar (line 20) | function isSimilar(word1, word2) {
function similarPairs (line 26) | function similarPairs(words) {
FILE: coding_interviews/leetcode/easy/count-pairs-whose-sum-is-less-than-target/count-pairs-whose-sum-is-less-than-target-two-pointers.js
function countPairs (line 3) | function countPairs(nums, target) {
FILE: coding_interviews/leetcode/easy/count-pairs-whose-sum-is-less-than-target/count-pairs-whose-sum-is-less-than-target.js
function countPairs (line 3) | function countPairs(nums, target) {
FILE: coding_interviews/leetcode/easy/count-prefixes-of-a-given-string/count-prefixes-of-a-given-string.js
function hasPrefix (line 1) | function hasPrefix(word, s) {
function countPrefixes (line 11) | function countPrefixes(words, s) {
FILE: coding_interviews/leetcode/easy/count-square-sum-triples/count-square-sum-triples.js
function countTriples (line 1) | function countTriples(n) {
FILE: coding_interviews/leetcode/easy/count-symmetric-integers/count-symmetric-integers.js
function isSymmetricIntegers (line 3) | function isSymmetricIntegers(num) {
function countSymmetricIntegers (line 20) | function countSymmetricIntegers(low, high) {
FILE: coding_interviews/leetcode/easy/count-the-digits-that-divide-a-number/count-the-digits-that-divide-a-number.js
function countDigits (line 1) | function countDigits(num) {
FILE: coding_interviews/leetcode/easy/count-the-number-of-vowel-strings-in-range/count-the-number-of-vowel-strings-in-range.js
constant VOWELS (line 1) | const VOWELS = ['a', 'e', 'i', 'o', 'u'];
function isVowelString (line 3) | function isVowelString(string) {
function vowelStrings (line 9) | function vowelStrings(words, left, right) {
FILE: coding_interviews/leetcode/easy/count-vowel-substrings-of-a-string/count-vowel-substrings-of-a-string.js
constant VOWELS (line 1) | const VOWELS = ['a', 'e', 'i', 'o', 'u'];
function isVowel (line 3) | function isVowel(char) {
function hasAllVowels (line 7) | function hasAllVowels(foundVowels) {
function countVowelSubstrings (line 17) | function countVowelSubstrings(word) {
FILE: coding_interviews/leetcode/easy/count_good_rectangles/count_good_rectangles.py
function count_good_rectangles (line 8) | def count_good_rectangles(rectangles):
function count_good_rectangles_optimized (line 25) | def count_good_rectangles_optimized(rectangles):
FILE: coding_interviews/leetcode/easy/count_matches/count_matches.py
function count_matches (line 3) | def count_matches(items, ruleKey, ruleValue):
FILE: coding_interviews/leetcode/easy/count_of_matches_in_tournament/count_of_matches_in_tournament.py
function number_of_matches (line 8) | def number_of_matches(n):
FILE: coding_interviews/leetcode/easy/count_students/count_students.py
function is_empty (line 3) | def is_empty(arr):
function count_students (line 6) | def count_students(students, sandwiches):
function count_students (line 36) | def count_students(students, sandwiches):
FILE: coding_interviews/leetcode/easy/count_the_number_of_consistent_strings/count_the_number_of_consistent_strings.py
function count_consistent_strings (line 8) | def count_consistent_strings(allowed, words):
function count_consistent_strings (line 34) | def count_consistent_strings(allowed, words):
FILE: coding_interviews/leetcode/easy/counting-bits/counting-bits.js
function countOnesInBinaryTransformation (line 1) | function countOnesInBinaryTransformation(number) {
function countBits (line 13) | function countBits(n) {
FILE: coding_interviews/leetcode/easy/counting-words-with-a-given-prefix/counting-words-with-a-given-prefix.js
function hasPrefix (line 1) | function hasPrefix(word, pref) {
function prefixCount (line 18) | function prefixCount(words, pref) {
FILE: coding_interviews/leetcode/easy/crawler-log-folder/crawler-log-folder.js
function minOperations (line 1) | function minOperations(logs) {
FILE: coding_interviews/leetcode/easy/create_target_array/create_target_array.py
function createTargetArray (line 4) | def createTargetArray(nums, index):
FILE: coding_interviews/leetcode/easy/decode-the-message/decode-the-message.js
function decodeMessage (line 1) | function decodeMessage(key, message) {
FILE: coding_interviews/leetcode/easy/decode_xored_array/decode_xored_array.py
function decode (line 3) | def decode(encoded, first):
FILE: coding_interviews/leetcode/easy/decompressed_encoded_list/decompressed_encoded_list.py
function build_frequencies (line 18) | def build_frequencies(frequency, num):
function decompress_list (line 22) | def decompress_list(nums):
FILE: coding_interviews/leetcode/easy/decrypt_string/decrypt_string.py
function alpha (line 3) | def alpha(num):
function freqAlphabets (line 6) | def freqAlphabets(s):
FILE: coding_interviews/leetcode/easy/defanging_an_ip_address/defanging_an_ip_address.py
function defang_ip_address (line 12) | def defang_ip_address(address):
FILE: coding_interviews/leetcode/easy/defuse-the-bomb/defuse-the-bomb.js
function sumNextK (line 1) | function sumNextK(code, from, k) {
function decryptNext (line 11) | function decryptNext(code, k) {
function sumPreviousK (line 24) | function sumPreviousK(code, from, k) {
function decryptPrevious (line 34) | function decryptPrevious(code, k) {
function decryptWithZeros (line 47) | function decryptWithZeros(code) {
function decrypt (line 51) | function decrypt(code, k) {
FILE: coding_interviews/leetcode/easy/delete-greatest-value-in-each-row/delete-greatest-value-in-each-row.js
function isEmpty (line 1) | function isEmpty(grid) {
function deleteGreatestValue (line 11) | function deleteGreatestValue(grid) {
FILE: coding_interviews/leetcode/easy/delete_columns_to_make_sorted/delete_columns_to_make_sorted.py
function min_deletion_size (line 3) | def min_deletion_size(strs):
FILE: coding_interviews/leetcode/easy/design_parking_system/design_parking_system.py
class ParkingSystem (line 3) | class ParkingSystem:
method __init__ (line 4) | def __init__(self, big, medium, small):
method add_car (line 9) | def add_car(self, car_type):
FILE: coding_interviews/leetcode/easy/destination_city/destination_city.py
function dest_city (line 1) | def dest_city(paths):
function dest_city (line 12) | def dest_city(paths):
FILE: coding_interviews/leetcode/easy/detect-capital/detect-capital.js
function allCapitals (line 1) | function allCapitals(word) {
function allNotCapitals (line 5) | function allNotCapitals(word) {
function firstCapital (line 9) | function firstCapital(word) {
function detectCapitalUse (line 13) | function detectCapitalUse(word) {
FILE: coding_interviews/leetcode/easy/determine-if-string-halves-are-alike/determine-if-string-halves-are-alike.js
constant VOWELS (line 1) | const VOWELS = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'];
function getVowelsCount (line 3) | function getVowelsCount(string) {
function halvesAreAlike (line 13) | function halvesAreAlike(s) {
FILE: coding_interviews/leetcode/easy/determine_color_of_a_chessboard_square/determine_color_of_a_chessboard_square.py
function is_even (line 14) | def is_even(num):
function square_is_white (line 17) | def square_is_white(coordinates):
function square_is_white (line 22) | def square_is_white(coordinates):
function square_is_white (line 26) | def square_is_white(coordinates):
FILE: coding_interviews/leetcode/easy/di_string_match/di_string_match.py
function di_string_match (line 3) | def di_string_match(S):
FILE: coding_interviews/leetcode/easy/difference-between-element-sum-and-digit-sum-of-an-array/difference-between-element-sum-and-digit-sum-of-an-array.js
function getDigitsSum (line 1) | function getDigitsSum(num) {
function differenceOfSum (line 12) | function differenceOfSum(nums) {
FILE: coding_interviews/leetcode/easy/discount_price/discount_price.py
function finalPrices (line 1) | def finalPrices(prices):
function get_discount (line 11) | def get_discount(prices, index, price):
FILE: coding_interviews/leetcode/easy/distribute-candies-among-children-i/distribute-candies-among-children-i.js
function distributeCandies (line 3) | function distributeCandies(n, limit) {
FILE: coding_interviews/leetcode/easy/distribute-candies-among-children-i/distribute-candies-among-children-ii.js
function distributeCandies (line 3) | function distributeCandies(n, limit) {
FILE: coding_interviews/leetcode/easy/distribute-candies-to-people/distribute-candies-to-people.js
function initPeopleCandies (line 1) | function initPeopleCandies(numPeople) {
function distributeCandies (line 11) | function distributeCandies(candies, numPeople) {
FILE: coding_interviews/leetcode/easy/divide-a-string-into-groups-of-size-k/divide-a-string-into-groups-of-size-k.js
function fillChar (line 1) | function fillChar(lastGroup, fill, length) {
function divideString (line 11) | function divideString(s, k, fill) {
FILE: coding_interviews/leetcode/easy/divide-array-into-equal-pairs/divide-array-into-equal-pairs.js
function divideArray (line 1) | function divideArray(nums) {
FILE: coding_interviews/leetcode/easy/divisible-and-non-divisible-sums-difference/divisible-and-non-divisible-sums-difference.js
function differenceOfSums (line 3) | function differenceOfSums(n, m) {
FILE: coding_interviews/leetcode/easy/divisor-game/divisor-game.js
function divisorGame (line 3) | function divisorGame(n) {
FILE: coding_interviews/leetcode/easy/equal_reversed_arrays/equal_reversed_arrays.py
function can_be_equal (line 23) | def can_be_equal(target, arr):
function can_be_equal (line 29) | def can_be_equal(target, arr):
function can_be_equal (line 52) | def can_be_equal(target, arr):
FILE: coding_interviews/leetcode/easy/evaluate-boolean-binary-tree/evaluate-boolean-binary-tree.js
function evaluateTree (line 6) | function evaluateTree(root) {
FILE: coding_interviews/leetcode/easy/even_digits/even_digits.py
function find_numbers (line 4) | def find_numbers(nums):
FILE: coding_interviews/leetcode/easy/excel-sheet-column-number/excel-sheet-column-number.js
function toNumber (line 1) | function toNumber(char) {
function titleToNumber (line 5) | function titleToNumber(columnTitle) {
FILE: coding_interviews/leetcode/easy/fair-candy-swap/fair-candy-swap-optimized.js
function sum (line 1) | function sum(nums) {
function buildMap (line 11) | function buildMap(bobSizes) {
function fairCandySwap (line 21) | function fairCandySwap(aliceSizes, bobSizes) {
FILE: coding_interviews/leetcode/easy/fair-candy-swap/fair-candy-swap.js
function sum (line 1) | function sum(nums) {
function fairCandySwap (line 11) | function fairCandySwap(aliceSizes, bobSizes) {
FILE: coding_interviews/leetcode/easy/faulty-keyboard/faulty-keyboard.js
function reverse (line 3) | function reverse(s) {
function finalString (line 13) | function finalString(s) {
FILE: coding_interviews/leetcode/easy/fibonacci_number/fibonacci_number.py
function fib (line 3) | def fib(n):
FILE: coding_interviews/leetcode/easy/final-value-after-operations/final-value-after-operations.js
function finalValueAfterOperations (line 46) | function finalValueAfterOperations(operations = []) {
FILE: coding_interviews/leetcode/easy/find-all-k-distant-indices-in-an-array/find-all-k-distant-indices-in-an-array.js
function getJs (line 1) | function getJs(nums, key) {
function isKDistant (line 11) | function isKDistant(index, js, k) {
function findKDistantIndices (line 19) | function findKDistantIndices(nums, key, k) {
FILE: coding_interviews/leetcode/easy/find-all-numbers-disappeared-in-an-array/find-all-numbers-disappeared-in-an-array.js
function buildMap (line 1) | function buildMap(nums) {
function findDisappearedNumbers (line 11) | function findDisappearedNumbers(nums) {
FILE: coding_interviews/leetcode/easy/find-center-of-star-graph/find-center-of-star-graph.js
function addConnection (line 1) | function addConnection(nodeToConnectionsCount, node) {
function findCenter (line 9) | function findCenter(edges) {
FILE: coding_interviews/leetcode/easy/find-champion-i/find-champion-i-no-map.js
function findChampion (line 3) | function findChampion(grid) {
FILE: coding_interviews/leetcode/easy/find-champion-i/find-champion-i.js
function findChampion (line 3) | function findChampion(grid) {
FILE: coding_interviews/leetcode/easy/find-first-palindromic-string-in-the-array/find-first-palindromic-string-in-the-array.js
function isPalindrome (line 1) | function isPalindrome(word) {
function firstPalindrome (line 11) | function firstPalindrome(words) {
FILE: coding_interviews/leetcode/easy/find-indices-with-index-and-value-difference-i/find-indices-with-index-and-value-difference-i.js
function findIndices (line 3) | function findIndices(nums, indexDifference, valueDifference) {
FILE: coding_interviews/leetcode/easy/find-lucky-integer-in-an-array/find-lucky-integer-in-an-array.js
function buildNumCounter (line 1) | function buildNumCounter(nums) {
function findLucky (line 12) | function findLucky(nums) {
FILE: coding_interviews/leetcode/easy/find-maximum-number-of-string-pairs/find-maximum-number-of-string-pairs.js
function paired (line 3) | function paired(s1, s2) {
function maximumNumberOfStringPairs (line 13) | function maximumNumberOfStringPairs(words) {
FILE: coding_interviews/leetcode/easy/find-subarrays-with-equal-sum/find-subarrays-with-equal-sum.js
function findSubarrays (line 1) | function findSubarrays(nums) {
FILE: coding_interviews/leetcode/easy/find-target-indices-after-sorting-array/find-target-indices-after-sorting-array.js
function targetIndices (line 1) | function targetIndices(nums, target) {
FILE: coding_interviews/leetcode/easy/find-the-array-concatenation-value/find-the-array-concatenation-value.js
function concat (line 1) | function concat(num1, num2) {
function findTheArrayConcVal (line 5) | function findTheArrayConcVal(nums) {
FILE: coding_interviews/leetcode/easy/find-the-difference-of-two-arrays/find-the-difference-of-two-arrays.js
function buildHashmap (line 1) | function buildHashmap(nums) {
function buildDistinct (line 11) | function buildDistinct(nums, hashmap) {
function findDifference (line 24) | function findDifference(nums1, nums2) {
FILE: coding_interviews/leetcode/easy/find-the-difference/find-the-difference.js
function buildMap (line 1) | function buildMap(string) {
function findTheDifference (line 12) | function findTheDifference(s, t) {
FILE: coding_interviews/leetcode/easy/find-the-distance-value-between-two-arrays/find-the-distance-value-between-two-arrays.js
function hasSmallerValue (line 3) | function hasSmallerValue(num, arr, d) {
function findTheDistanceValue (line 11) | function findTheDistanceValue(arr1, arr2, d) {
FILE: coding_interviews/leetcode/easy/find-the-distinct-difference-array/find-the-distinct-difference-array.js
function countDistinct (line 3) | function countDistinct(nums, startIndex, endIndex) {
function countDistinctPrefix (line 17) | function countDistinctPrefix(nums, index) {
function countDistinctSufix (line 21) | function countDistinctSufix(nums, index) {
function distinctDifferenceArray (line 25) | function distinctDifferenceArray(nums) {
FILE: coding_interviews/leetcode/easy/find-the-distinct-difference-array/optimized-find-the-distinct-difference-array.js
function distinctDifferenceArray (line 3) | function distinctDifferenceArray(nums) {
FILE: coding_interviews/leetcode/easy/find-the-maximum-achievable-number/find-the-maximum-achievable-number.js
function theMaximumAchievableX (line 3) | function theMaximumAchievableX(num, t) {
FILE: coding_interviews/leetcode/easy/find-the-middle-index-in-array/find-the-middle-index-in-array.js
function sum (line 1) | function sum(nums) {
function findMiddleIndex (line 5) | function findMiddleIndex(nums) {
FILE: coding_interviews/leetcode/easy/find-the-pivot-integer/find-the-pivot-integer.js
constant NO_PIVOT (line 1) | const NO_PIVOT = -1;
function sum (line 3) | function sum(n) {
function pivotInteger (line 13) | function pivotInteger(n) {
FILE: coding_interviews/leetcode/easy/find-the-width-of-columns-of-a-grid/find-the-width-of-columns-of-a-grid.js
function findColumnWidth (line 3) | function findColumnWidth(grid) {
FILE: coding_interviews/leetcode/easy/find-words-containing-character/find-words-containing-character.js
function findWordsContaining (line 3) | function findWordsContaining(words, x) {
FILE: coding_interviews/leetcode/easy/find-words-that-can-be-formed-by-characters/find-words-that-can-be-formed-by-characters.js
function buildCounter (line 1) | function buildCounter(chars) {
function isGood (line 12) | function isGood(word, counterCopy) {
function countCharacters (line 22) | function countCharacters(words, chars) {
FILE: coding_interviews/leetcode/easy/find_common_characters/find_common_characters.py
function common_chars (line 3) | def common_chars(A):
FILE: coding_interviews/leetcode/easy/find_the_highest_altitude/find_the_highest_altitude.py
function largest_altitude (line 3) | def largest_altitude(gain):
FILE: coding_interviews/leetcode/easy/first-bad-version/first-bad-version-binary-search.js
function getMiddle (line 1) | function getMiddle(start, end) {
function binarySearchFirstBadVersion (line 5) | function binarySearchFirstBadVersion(isBadVersion) {
function solution (line 30) | function solution(isBadVersion) {
FILE: coding_interviews/leetcode/easy/first-bad-version/first-bad-version.js
function solution (line 1) | function solution(isBadVersion) {
FILE: coding_interviews/leetcode/easy/first-letter-to-appear-twice/first-letter-to-appear-twice.js
function repeatedCharacter (line 1) | function repeatedCharacter(s) {
FILE: coding_interviews/leetcode/easy/first-unique-character-in-a-string/first-unique-character-in-a-string.js
function firstUniqChar (line 1) | function firstUniqChar(s) {
FILE: coding_interviews/leetcode/easy/first_bad_version/first_bad_version.py
function is_bad_version (line 54) | def is_bad_version(version):
function first_bad_version (line 58) | def first_bad_version(n):
FILE: coding_interviews/leetcode/easy/fizz-buzz/fizz-buzz.js
function fizzBuzz (line 1) | function fizzBuzz(n) {
FILE: coding_interviews/leetcode/easy/flipping_an_image.py
function flip_and_invert_image (line 6) | def flip_and_invert_image(image):
FILE: coding_interviews/leetcode/easy/flood-fill/flood-fill-without-visited.js
function isInsideTheGrid (line 1) | function isInsideTheGrid(image, row, col) {
function dfs (line 7) | function dfs(image, row, col, newColor, startingPixel) {
function floodFill (line 17) | function floodFill(image, row, col, newColor) {
FILE: coding_interviews/leetcode/easy/flood-fill/flood-fill.js
function isInsideTheGrid (line 8) | function isInsideTheGrid(image, row, col) {
function floodFillHelper (line 14) | function floodFillHelper(image, sr, sc, newColor, startingPixel, visited) {
function buildVisitedMatrix (line 81) | function buildVisitedMatrix(image) {
function floodFill (line 97) | function floodFill(image, sr, sc, newColor) {
FILE: coding_interviews/leetcode/easy/furthest-point-from-origin/furthest-point-from-origin.js
function furthestDistanceFromOrigin (line 3) | function furthestDistanceFromOrigin(moves) {
FILE: coding_interviews/leetcode/easy/generate_the_string/generate_the_string.py
function generate_the_string (line 3) | def generate_the_string(n):
FILE: coding_interviews/leetcode/easy/goal_parser_interpretation/goal_parser_interpretation.py
function interpret (line 4) | def interpret(command):
FILE: coding_interviews/leetcode/easy/greatest-english-letter-in-upper-and-lower-case/greatest-english-letter-in-upper-and-lower-case.js
function greatestLetter (line 1) | function greatestLetter(string) {
FILE: coding_interviews/leetcode/easy/greatest_candies/greatest_candies.py
function kids_with_candies (line 9) | def kids_with_candies(candies, extra_candies):
function map_can_be_greatest (line 14) | def map_can_be_greatest(candies, extra_candies, greatest_candy):
function get_greatest (line 23) | def get_greatest(candies):
FILE: coding_interviews/leetcode/easy/guess-number-higher-or-lower/guess-number-higher-or-lower.js
function guessNumber (line 3) | function guessNumber(n) {
FILE: coding_interviews/leetcode/easy/halves_are_alike/halves_are_alike.py
function halves_are_alike (line 4) | def halves_are_alike(s):
FILE: coding_interviews/leetcode/easy/hamming_distance/hamming_distance.py
function get_bit (line 1) | def get_bit(number):
function hamming_distance (line 4) | def hamming_distance(x, y):
function hamming_distance_2 (line 28) | def hamming_distance_2(x, y):
FILE: coding_interviews/leetcode/easy/height_checker/height_checker.py
function height_checker (line 3) | def height_checker(heights):
FILE: coding_interviews/leetcode/easy/implement-stack-using-queues/implement-stack-using-queues.js
function MyStack (line 1) | function MyStack() {
FILE: coding_interviews/leetcode/easy/increasing_decreasing_string/incresing_decreasin_string.py
function sort_string (line 5) | def sort_string(s):
FILE: coding_interviews/leetcode/easy/increasing_order_search_tree/increasing_order_search_tree.py
function increasingBST (line 1) | def increasingBST(root):
function helper (line 13) | def helper(self, old_tree, arr):
FILE: coding_interviews/leetcode/easy/intersection-of-multiple-arrays/intersection-of-multiple-arrays.js
function intersection (line 1) | function intersection(nums) {
FILE: coding_interviews/leetcode/easy/intersection-of-two-arrays-ii/intersection-of-two-arrays-ii.js
function intersect (line 14) | function intersect(nums1, nums2) {
FILE: coding_interviews/leetcode/easy/intersection_of_two_arrays/intersection_of_two_arrays.py
function intersection (line 4) | def intersection(nums1, nums2):
function intersection (line 14) | def intersection(nums1, nums2):
function intersection (line 18) | def intersection(nums1, nums2):
FILE: coding_interviews/leetcode/easy/intersection_of_two_arrays_ii/intersection_of_two_arrays.py
function intersection (line 4) | def intersection(nums1, nums2):
FILE: coding_interviews/leetcode/easy/invert-binary-tree/invert-binary-tree.js
function invertTree (line 1) | function invertTree(root) {
FILE: coding_interviews/leetcode/easy/is-subsequence/is-subsequence.js
function isSubsequence (line 3) | function isSubsequence(s, t) {
FILE: coding_interviews/leetcode/easy/is_palindrome.py
function is_palindrome (line 3) | def is_palindrome(x):
FILE: coding_interviews/leetcode/easy/is_sum_equal/is_sum_equal.py
function get_numerical_value (line 16) | def get_numerical_value(word):
function is_sum_equal (line 24) | def is_sum_equal(first_word, second_word, target_word):
FILE: coding_interviews/leetcode/easy/island-perimeter/island-perimeter.js
function isOffGrid (line 1) | function isOffGrid(grid, row, col) {
function isWater (line 5) | function isWater(grid, row, col) {
function isPartOfIsland (line 9) | function isPartOfIsland(grid, row, col) {
function wasAlreadyVisited (line 13) | function wasAlreadyVisited(grid, row, col) {
function dfs (line 17) | function dfs(grid, row, col) {
function islandPerimeter (line 36) | function islandPerimeter(grid) {
FILE: coding_interviews/leetcode/easy/jewels_and_stones.py
function num_jewels_in_stones (line 12) | def num_jewels_in_stones(J, S):
function num_jewels_in_stones_opt (line 29) | def num_jewels_in_stones_opt(J, S):
FILE: coding_interviews/leetcode/easy/judge_route_circle.py
function judge_circle (line 13) | def judge_circle(moves):
FILE: coding_interviews/leetcode/easy/judge_route_circle_one_line.py
function judge_circle (line 13) | def judge_circle(moves):
FILE: coding_interviews/leetcode/easy/k-items-with-the-maximum-sum/k-items-with-the-maximum-sum-second.js
function kItemsWithMaximumSum (line 3) | function kItemsWithMaximumSum(numOnes, numZeros, numNegOnes, k) {
FILE: coding_interviews/leetcode/easy/k-items-with-the-maximum-sum/k-items-with-the-maximum-sum.js
function kItemsWithMaximumSum (line 3) | function kItemsWithMaximumSum(numOnes, numZeros, numNegOnes, k) {
FILE: coding_interviews/leetcode/easy/keep-multiplying-found-values-by-two/keep-multiplying-found-values-by-two.js
function findFinalValue (line 1) | function findFinalValue(nums, original) {
FILE: coding_interviews/leetcode/easy/keyboard-row/keyboard-row.js
function stringToMap (line 1) | function stringToMap(string) {
function belongsToRow (line 15) | function belongsToRow(word, row) {
function belongsToSomeRow (line 25) | function belongsToSomeRow(word) {
function findWords (line 34) | function findWords(words) {
FILE: coding_interviews/leetcode/easy/kth-distinct-string-in-an-array/kth-distinct-string-in-an-array.js
function kthDistinct (line 1) | function kthDistinct(arr, k) {
function kthDistinct (line 29) | function kthDistinct(arr, k) {
FILE: coding_interviews/leetcode/easy/largest-local-values-in-a-matrix/largest-local-values-in-a-matrix.js
function getLargestFromGrid (line 1) | function getLargestFromGrid(grid, startRow, startCol, endRow, endCol) {
function largestLocal (line 13) | function largestLocal(grid) {
FILE: coding_interviews/leetcode/easy/largest-number-after-digit-swaps-by-parity/largest-number-after-digit-swaps-by-parity.js
function largestInteger (line 6) | function largestInteger(num) {
FILE: coding_interviews/leetcode/easy/largest-positive-integer-that-exists-with-its-negative/largest-positive-integer-that-exists-with-its-negative.js
function findMaxK (line 1) | function findMaxK(nums) {
FILE: coding_interviews/leetcode/easy/last-stone-weight/last-stone-weight.js
function getTwoHaviest (line 1) | function getTwoHaviest(stones) {
function removeStone (line 26) | function removeStone(stones, stoneToBeRemoved) {
function updateStone (line 35) | function updateStone(stones, stone, stoneWeight) {
function lastStoneWeight (line 44) | function lastStoneWeight(stones) {
FILE: coding_interviews/leetcode/easy/last-visited-integers/last-visited-integers.js
function getLastInteger (line 3) | function getLastInteger(words, lastNumberIndex, consecutivePrevs) {
function lastVisitedIntegers (line 25) | function lastVisitedIntegers(words) {
FILE: coding_interviews/leetcode/easy/leaf-similar-trees/leaf-similar-trees.js
function getLeafValueSequence (line 10) | function getLeafValueSequence(node, leafValueSequence) {
function hasSimilarLeafSequence (line 21) | function hasSimilarLeafSequence(leafValueSequence1, leafValueSequence2) {
function leafSimilar (line 31) | function leafSimilar(root1, root2) {
FILE: coding_interviews/leetcode/easy/left-and-right-sum-differences/left-and-right-sum-differences.js
function sum (line 1) | function sum(nums) {
function leftRigthDifference (line 11) | function leftRigthDifference(nums) {
FILE: coding_interviews/leetcode/easy/lexicographically-smallest-palindrome/lexicographically-smallest-palindrome.js
function makeSmallestPalindrome (line 1) | function makeSmallestPalindrome(string) {
FILE: coding_interviews/leetcode/easy/linked-list-cycle/linked-list-cycle.js
function hasCycle (line 1) | function hasCycle(head) {
FILE: coding_interviews/leetcode/easy/longer-contiguous-segments-of-ones-than-zeros/longer-contiguous-segments-of-ones-than-zeros.js
function checkZeroOnes (line 1) | function checkZeroOnes(s) {
FILE: coding_interviews/leetcode/easy/longest-nice-substring/longest-nice-substring.js
function isNice (line 1) | function isNice(substring, map) {
function longestNiceSubstring (line 11) | function longestNiceSubstring(s) {
FILE: coding_interviews/leetcode/easy/longest-subsequence-with-limited-sum/longest-subsequence-with-limited-sum.js
function immutableSort (line 1) | function immutableSort(nums) {
function buildAllSums (line 5) | function buildAllSums(nums) {
function answerQueries (line 17) | function answerQueries(nums, queries) {
FILE: coding_interviews/leetcode/easy/longest_palindrome.py
function count_pairs (line 1) | def count_pairs(letters):
function main (line 21) | def main(letters):
FILE: coding_interviews/leetcode/easy/lowest-common-ancestor-of-a-binary-search-tree/lowest-common-ancestor-of-a-binary-search-tree.js
function lowestCommonAncestor (line 1) | function lowestCommonAncestor(root, p, q) {
FILE: coding_interviews/leetcode/easy/lucky_numbers_in_a_matrix/lucky_numbers_in_a_matrix.py
function lucky_numbers (line 3) | def lucky_numbers(matrix):
FILE: coding_interviews/leetcode/easy/majority-element/majority-element.js
function majorityElement (line 1) | function majorityElement(nums) {
FILE: coding_interviews/leetcode/easy/make-array-zero-by-subtracting-equal-amounts/make-array-zero-by-subtracting-equal-amounts.js
function minimumOperationsAllInOne (line 1) | function minimumOperationsAllInOne(nums) {
function smallestExceptZeros (line 34) | function smallestExceptZeros(smallest, num) {
function getSmallest (line 38) | function getSmallest(nums) {
function performSubtraction (line 50) | function performSubtraction(nums, smallestToSubtract, smallest) {
function minimumOperations (line 63) | function minimumOperations(nums) {
function minimumOperationsSet (line 77) | function minimumOperationsSet(nums) {
FILE: coding_interviews/leetcode/easy/make-the-string-great/make-the-string-great.js
function isUpperCase (line 1) | function isUpperCase(char1, char2) {
function isLowerCase (line 5) | function isLowerCase(char1, char2) {
function isBadPair (line 9) | function isBadPair(char1, char2) {
function makeGood (line 18) | function makeGood(string, pointer1 = 0, pointer2 = 1) {
FILE: coding_interviews/leetcode/easy/matrix-cells-in-distance-order/matrix-cells-in-distance-order.js
function sortDistances (line 1) | function sortDistances(distances) {
function allCellsDistOrder (line 5) | function allCellsDistOrder(rows, cols, rCenter, cCenter) {
FILE: coding_interviews/leetcode/easy/matrix_diagonal_sum/matrix_diagonal_sum.py
function diagonal_sum (line 8) | def diagonal_sum(mat):
FILE: coding_interviews/leetcode/easy/matrix_negative_numbers/matrix_negative_numbers.py
function count_negatives (line 1) | def count_negatives(grid):
FILE: coding_interviews/leetcode/easy/max-consecutive-ones/max-consecutive-ones.js
function findMaxConsecutiveOnes (line 1) | function findMaxConsecutiveOnes(nums) {
FILE: coding_interviews/leetcode/easy/maximum-69-number/maximum-69-number.js
function maximum69Number (line 1) | function maximum69Number(num) {
FILE: coding_interviews/leetcode/easy/maximum-ascending-subarray-sum/maximum-ascending-subarray-sum.js
function maxAscendingSum (line 1) | function maxAscendingSum(nums) {
FILE: coding_interviews/leetcode/easy/maximum-count-of-positive-integer-and-negative-integer/maximum-count-of-positive-integer-and-negative-integer.js
function maximumCount (line 1) | function maximumCount(nums) {
FILE: coding_interviews/leetcode/easy/maximum-depth-of-binary-tree/maximum-depth-of-binary-tree-2.js
function getMaximumDepth (line 1) | function getMaximumDepth(node, depth) {
function maxDepth (line 12) | function maxDepth(root) {
function maxDepth (line 24) | function maxDepth(root, depth = 0) {
FILE: coding_interviews/leetcode/easy/maximum-depth-of-n-ary-tree/maximum-depth-of-n-ary-tree.js
function maxDepth (line 1) | function maxDepth(root, depth = 1) {
FILE: coding_interviews/leetcode/easy/maximum-number-of-balloons/maximum-number-of-balloons.js
function buildHashmap (line 1) | function buildHashmap(text) {
function maxNumberOfBalloons (line 12) | function maxNumberOfBalloons(text) {
FILE: coding_interviews/leetcode/easy/maximum-number-of-pairs-in-array/maximum-number-of-pairs-in-array.js
function numberOfPairs (line 1) | function numberOfPairs(nums) {
FILE: coding_interviews/leetcode/easy/maximum-odd-binary-number/maximum-odd-binary-number.js
function countOnesAndZeros (line 3) | function countOnesAndZeros(s) {
function maximumOddBinaryNumber (line 18) | function maximumOddBinaryNumber(s) {
FILE: coding_interviews/leetcode/easy/maximum-subarray/maximum-subarray.js
function maxSubArray (line 1) | function maxSubArray(nums) {
FILE: coding_interviews/leetcode/easy/maximum-sum-with-exactly-k-elements/maximum-sum-with-exactly-k-elements.js
function getBiggest (line 1) | function getBiggest(nums) {
function maximizeSum (line 11) | function maximizeSum(nums, k) {
FILE: coding_interviews/leetcode/easy/maximum-units-on-a-truck/maximum-units-on-a-truck.py
function maximum_units (line 3) | def maximum_units(box_types, truck_size):
FILE: coding_interviews/leetcode/easy/maximum-value-of-a-string-in-an-array/maximum-value-of-a-string-in-an-array.js
function maximumValue (line 1) | function maximumValue(strs) {
FILE: coding_interviews/leetcode/easy/maximum_nesting_depth_of_the_parentheses/maximum_nesting_depth_of_the_parentheses.py
function max_depth (line 3) | def max_depth(s):
FILE: coding_interviews/leetcode/easy/maximum_number_of_balls_in_a_box/maximum_number_of_balls_in_a_box.py
function get_box (line 3) | def get_box(ball):
function count_balls (line 12) | def count_balls(low_limit, high_limit):
FILE: coding_interviews/leetcode/easy/maximum_population/maximum_population.py
function maximum_population (line 3) | def maximum_population(logs):
FILE: coding_interviews/leetcode/easy/maximum_product/maximum_product.py
function max_product (line 4) | def max_product(nums):
function max_product (line 9) | def max_product(nums):
FILE: coding_interviews/leetcode/easy/mean-of-array-after-removing-some-elements/mean-of-array-after-removing-some-elements.js
function removeFivePercent (line 1) | function removeFivePercent(numbers) {
function sum (line 7) | function sum(numbers) {
function trimMean (line 11) | function trimMean(numbers) {
FILE: coding_interviews/leetcode/easy/merge-nodes-in-between-zeros/merge-nodes-in-between-zeros.js
class ListNode (line 1) | class ListNode {
method constructor (line 2) | constructor(val, next) {
function mergeNodes (line 8) | function mergeNodes(head) {
FILE: coding_interviews/leetcode/easy/merge-nodes-in-between-zeros/tests/merge-nodes-in-between-zeros.test.js
function buildList (line 4) | function buildList(nums, initValue = 0) {
FILE: coding_interviews/leetcode/easy/merge-similar-items/merge-similar-items.js
function fillHashmapAndList (line 1) | function fillHashmapAndList(items, hashmap, list) {
function mergeSimilarItems (line 12) | function mergeSimilarItems(items1, items2) {
FILE: coding_interviews/leetcode/easy/merge-sorted-array/merge-sorted-array.js
function merge (line 12) | function merge(nums1, m, nums2, n) {
FILE: coding_interviews/leetcode/easy/merge-two-2d-arrays-by-summing-values/merge-two-2d-arrays-by-summing-values.js
function mergeArrays (line 1) | function mergeArrays(nums1, nums2) {
FILE: coding_interviews/leetcode/easy/merge-two-binary-trees/merge-two-binary-trees.js
function mergeTrees (line 1) | function mergeTrees(root1, root2) {
FILE: coding_interviews/leetcode/easy/merge-two-sorted-lists/merge-two-sorted-lists.js
class ListNode (line 1) | class ListNode {
method constructor (line 2) | constructor(val, next) {
function mergeTwoLists (line 8) | function mergeTwoLists(list1, list2) {
FILE: coding_interviews/leetcode/easy/merge-two-sorted-lists/tests/merge-two-sorted-lists.test.js
function buildList (line 4) | function buildList(nums) {
FILE: coding_interviews/leetcode/easy/merge_strings_alternately/merge_strings_alternately.py
function mergeAlternately (line 3) | def mergeAlternately(word1, word2):
FILE: coding_interviews/leetcode/easy/merge_trees.py
class TreeNode (line 21) | class TreeNode(object):
method __init__ (line 22) | def __init__(self, val):
function merge_trees (line 27) | def merge_trees(t1, t2):
FILE: coding_interviews/leetcode/easy/merge_two_lists.py
class ListNode (line 3) | class ListNode(object):
method __init__ (line 4) | def __init__(self, x):
function merge_two_lists (line 8) | def merge_two_lists(l1, l2):
FILE: coding_interviews/leetcode/easy/middle-of-the-linked-list/middle-of-the-linked-list-fast-slow.js
function middleNode (line 1) | function middleNode(head) {
FILE: coding_interviews/leetcode/easy/middle-of-the-linked-list/middle-of-the-linked-list.js
function getNodeCount (line 19) | function getNodeCount(node, count) {
function getNode (line 23) | function getNode(node, index) {
function middleNode (line 27) | function middleNode(head) {
FILE: coding_interviews/leetcode/easy/min-max-game/min-max-game.js
function minMaxGame (line 1) | function minMaxGame(nums) {
FILE: coding_interviews/leetcode/easy/minimize-string-length/minimize-string-length.js
function minimizedStringLength (line 3) | function minimizedStringLength(s) {
FILE: coding_interviews/leetcode/easy/minimum-absolute-difference-in-bst/minimum-absolute-difference-in-bst.js
function getMinimumDifference (line 1) | function getMinimumDifference(root, rootVal = Infinity) {
function traverse (line 12) | function traverse(node, list) {
function diff (line 19) | function diff(list) {
function getMinimumDifference (line 31) | function getMinimumDifference(root) {
FILE: coding_interviews/leetcode/easy/minimum-bit-flips-to-convert-number/minimum-bit-flips-to-convert-number.js
function toBinary (line 1) | function toBinary(number) {
function minBitFlips (line 12) | function minBitFlips(start, goal) {
FILE: coding_interviews/leetcode/easy/minimum-cost-to-move-chips-to-the-same-position/minimum-cost-to-move-chips-to-the-same-position.js
function minCostToMoveChips (line 1) | function minCostToMoveChips(positions) {
FILE: coding_interviews/leetcode/easy/minimum-depth-of-binary-tree/minimum-depth-of-binary-tree.js
function minDepth (line 11) | function minDepth(node, depth = 1) {
FILE: coding_interviews/leetcode/easy/minimum-distance-between-bst-nodes/minimum-distance-between-bst-nodes.js
function traverse (line 1) | function traverse(node, list) {
function getMinDiff (line 8) | function getMinDiff(list) {
function minDiffInBST (line 20) | function minDiffInBST(root) {
FILE: coding_interviews/leetcode/easy/minimum-number-game/minimum-number-game.js
function numberGame (line 3) | function numberGame(nums) {
FILE: coding_interviews/leetcode/easy/minimum-number-of-moves-to-seat-everyone/minimum-number-of-moves-to-seat-everyone.js
function sort (line 1) | function sort(nums) {
function minMovesToSeat (line 5) | function minMovesToSeat(seats, students) {
FILE: coding_interviews/leetcode/easy/minimum-number-of-operations-to-convert-time/minimum-number-of-operations-to-convert-time.js
function toMinutes (line 1) | function toMinutes(stringTime) {
function convertTime (line 6) | function convertTime(current, correct) {
FILE: coding_interviews/leetcode/easy/minimum-string-length-after-removing-substrings/minimum-string-length-after-removing-substrings.js
function minLength (line 3) | function minLength(s) {
FILE: coding_interviews/leetcode/easy/minimum-subsequence-in-non-increasing-order/minimum-subsequence-in-non-increasing-order.js
function sum (line 1) | function sum(nums) {
function minSubsequence (line 5) | function minSubsequence(nums) {
FILE: coding_interviews/leetcode/easy/minimum-sum-of-mountain-triplets-i/minimum-sum-of-mountain-triplets-i.js
function minimumSum (line 3) | function minimumSum(nums) {
FILE: coding_interviews/leetcode/easy/minimum-sum/minimum-sum.js
function getAllDigits (line 25) | function getAllDigits(number) {
function sort (line 36) | function sort(digits) {
function minimumSum (line 40) | function minimumSum(number) {
function altMinimunSum (line 51) | function altMinimunSum(number) {
FILE: coding_interviews/leetcode/easy/minimum-value-to-get-positive-step-by-step-sum/minimum-value-to-get-positive-step-by-step-sum.js
function getMinValue (line 1) | function getMinValue(nums) {
function minStartValue (line 13) | function minStartValue(nums) {
FILE: coding_interviews/leetcode/easy/minimum_operations_to_make_the_array_increasing/minimum_operations_to_make_the_array_increasing.py
function min_operations (line 3) | def min_operations(nums):
function min_operations (line 17) | def min_operations(nums):
FILE: coding_interviews/leetcode/easy/missing-number/missing-number.js
function buildHashmap (line 1) | function buildHashmap(nums) {
function getMissingNumber (line 11) | function getMissingNumber(numsLength, hashmap) {
function missingNumber (line 17) | function missingNumber(nums) {
FILE: coding_interviews/leetcode/easy/monotonic-array/monotonic-array.js
function isMonotonic (line 1) | function isMonotonic(nums) {
FILE: coding_interviews/leetcode/easy/most-words-found/most-words-found.js
function mostWordsFound (line 22) | function mostWordsFound(sentences = []) {
FILE: coding_interviews/leetcode/easy/move-zeroes/move-zeroes-in-place.js
function moveZeroes (line 1) | function moveZeroes(nums) {
FILE: coding_interviews/leetcode/easy/move-zeroes/move-zeroes.js
function moveZeroes (line 1) | function moveZeroes(nums) {
FILE: coding_interviews/leetcode/easy/n_ary_tree_postorder_traversal/n_ary_tree_postorder_traversal.py
function postorder (line 5) | def postorder(root):
FILE: coding_interviews/leetcode/easy/n_ary_tree_preorder_traversal/n_ary_tree_preorder_traversal.py
function preorder (line 5) | def preorder(root):
FILE: coding_interviews/leetcode/easy/n_repeated_element_in_size_2n_array/n_repeated_element_in_size_2n_array.py
function n_repeated_element_in_size_2n_array (line 23) | def n_repeated_element_in_size_2n_array(A):
FILE: coding_interviews/leetcode/easy/neither-minimum-nor-maximum/neither-minimum-nor-maximum-on.js
function findNonMinOrMax (line 3) | function findNonMinOrMax(nums) {
FILE: coding_interviews/leetcode/easy/neither-minimum-nor-maximum/neither-minimum-nor-maximum.js
function findNonMinOrMax (line 3) | function findNonMinOrMax(nums) {
FILE: coding_interviews/leetcode/easy/next-greater-element-i/next-greater-element-i-optimized.js
function peek (line 1) | function peek(stack) {
function isEmpty (line 5) | function isEmpty(stack) {
function nextGreaterElement (line 9) | function nextGreaterElement(nums1, nums2) {
FILE: coding_interviews/leetcode/easy/next-greater-element-i/next-greater-element-i.js
function nextGreaterElement (line 1) | function nextGreaterElement(nums1, nums2) {
FILE: coding_interviews/leetcode/easy/num_unique_emails/num_unique_emails.py
function num_unique_emails (line 1) | def num_unique_emails(emails):
FILE: coding_interviews/leetcode/easy/number-of-1-bits/number-of-1-bits.js
function hammingWeight (line 1) | function hammingWeight(n) {
FILE: coding_interviews/leetcode/easy/number-of-arithmetic-triplets/number-of-arithmetic-triplets.js
function buildMap (line 1) | function buildMap(nums) {
function arithmeticTriplets (line 11) | function arithmeticTriplets(nums, diff) {
FILE: coding_interviews/leetcode/easy/number-of-common-factors/number-of-common-factors.js
function commonFactors (line 1) | function commonFactors(a, b) {
FILE: coding_interviews/leetcode/easy/number-of-employees-who-met-the-target/number-of-employees-who-met-the-target.js
function numberOfEmployeesWhoMetTarget (line 1) | function numberOfEmployeesWhoMetTarget(hours, target) {
FILE: coding_interviews/leetcode/easy/number-of-even-and-odd-bits/number-of-even-and-odd-bits.js
function toBinary (line 1) | function toBinary(n) {
function isEven (line 12) | function isEven(n) {
function isOdd (line 16) | function isOdd(n) {
function evenOddBit (line 20) | function evenOddBit(n) {
FILE: coding_interviews/leetcode/easy/number-of-lines-to-write-string/number-of-lines-to-write-string.js
function toWidthsIndex (line 3) | function toWidthsIndex(char) {
function numberOfLines (line 7) | function numberOfLines(widths, s) {
FILE: coding_interviews/leetcode/easy/number-of-senior-citizens/number-of-senior-citizens.js
function countSeniors (line 1) | function countSeniors(details) {
FILE: coding_interviews/leetcode/easy/number-of-senior-citizens/one-liner-number-of-senior-citizens.js
function countSeniors (line 1) | function countSeniors(details) {
FILE: coding_interviews/leetcode/easy/number-of-unequal-triplets-in-array/number-of-unequal-triplets-in-array.js
function unequalTriplets (line 1) | function unequalTriplets(nums) {
FILE: coding_interviews/leetcode/easy/number_complement.py
function to_binary (line 11) | def to_binary(num):
function to_binary_complement (line 21) | def to_binary_complement(binary_num):
function to_complement (line 24) | def to_complement(complement_binary_num):
function find_complement (line 27) | def find_complement(num):
FILE: coding_interviews/leetcode/easy/number_of_good_pairs/number_of_good_pairs.py
function factorial (line 1) | def factorial(n):
function permutation (line 5) | def permutation(n, r):
function number_of_good_pairs (line 8) | def number_of_good_pairs(nums):
function permutation (line 29) | def permutation(n, r):
function number_of_good_pairs (line 32) | def number_of_good_pairs(nums):
function number_of_good_pairs (line 51) | def number_of_good_pairs(nums):
function number_of_good_pairs (line 68) | def number_of_good_pairs(nums):
FILE: coding_interviews/leetcode/easy/number_of_recent_calls/number_of_recent_calls.py
class RecentCounter (line 3) | class RecentCounter:
method __init__ (line 4) | def __init__(self):
method ping (line 7) | def ping(self, t: int) -> int:
method __init__ (line 20) | def __init__(self):
method ping (line 23) | def ping(self, t: int) -> int:
class RecentCounter (line 19) | class RecentCounter:
method __init__ (line 4) | def __init__(self):
method ping (line 7) | def ping(self, t: int) -> int:
method __init__ (line 20) | def __init__(self):
method ping (line 23) | def ping(self, t: int) -> int:
FILE: coding_interviews/leetcode/easy/number_of_students/number_of_students.py
function busy_student (line 1) | def busy_student(start_time, end_time, query_time):
function busy_student (line 13) | def busy_student(start_time, end_time, query_time):
FILE: coding_interviews/leetcode/easy/odd-string-difference/odd-string-difference.js
function toCode (line 1) | function toCode(char) {
function buildDiffIntegerArray (line 5) | function buildDiffIntegerArray(word) {
function joinIntegersString (line 18) | function joinIntegersString(diff) {
function oddString (line 22) | function oddString(words) {
FILE: coding_interviews/leetcode/easy/odd_in_matrix/odd_in_matrix.py
function init_matrix (line 1) | def init_matrix(rows, columns):
function odd_cells (line 5) | def odd_cells(n, m, indices):
FILE: coding_interviews/leetcode/easy/partition_labels.py
function partition_labels (line 14) | def partition_labels(S):
FILE: coding_interviews/leetcode/easy/pascals-triangle/pascals-triangle.js
function generate (line 1) | function generate(numRows) {
FILE: coding_interviews/leetcode/easy/path-sum/path-sum.js
function hasPathSum (line 1) | function hasPathSum(root, targetSum, sum = 0) {
FILE: coding_interviews/leetcode/easy/peak_index_mountain.py
function peak_index_in_mountain_array (line 11) | def peak_index_in_mountain_array(A):
FILE: coding_interviews/leetcode/easy/percentage-of-letter-in-string/percentage-of-letter-in-string.js
function percentageLetter (line 1) | function percentageLetter(s, letter) {
FILE: coding_interviews/leetcode/easy/plus_one/plus_one.js
function add_one (line 3) | function add_one(digits) {
function plus_one (line 7) | function plus_one(digits, inc) {
FILE: coding_interviews/leetcode/easy/plus_one/plus_one.py
function add_one (line 4) | def add_one(digits):
function plus_one (line 8) | def plus_one(digits, inc):
FILE: coding_interviews/leetcode/easy/points-that-intersect-with-cars/points-that-intersect-with-cars.js
function numberOfPoints (line 3) | function numberOfPoints(nums) {
FILE: coding_interviews/leetcode/easy/power-of-two/power-of-two.js
function isPowerOfTwo (line 1) | function isPowerOfTwo(n) {
FILE: coding_interviews/leetcode/easy/prime-number-of-set-bits-in-binary-representation/prime-number-of-set-bits-in-binary-representation.js
function toBinary (line 3) | function toBinary(n) {
function getNumberOfSetBits (line 14) | function getNumberOfSetBits(binary) {
function isPrime (line 24) | function isPrime(num) {
function countPrimeSetBits (line 31) | function countPrimeSetBits(left, right) {
FILE: coding_interviews/leetcode/easy/projection-area-of-3d-shapes/projection-area-of-3d-shapes.js
function projectionArea (line 3) | function projectionArea(grid) {
FILE: coding_interviews/leetcode/easy/range_sum_of_bst/range_sum_of_bst.py
function rangeSumBST (line 19) | def rangeSumBST(root, L, R):
FILE: coding_interviews/leetcode/easy/rank-transform-of-an-array/rank-transform-of-an-array-less-memory.js
function buildMap (line 11) | function buildMap(set) {
function buildRank (line 23) | function buildRank(arr, map) {
function arrayRankTransform (line 31) | function arrayRankTransform(arr) {
FILE: coding_interviews/leetcode/easy/rank-transform-of-an-array/rank-transform-of-an-array.js
function buildMap (line 11) | function buildMap(set) {
function buildRank (line 23) | function buildRank(arr, map) {
function arrayRankTransform (line 33) | function arrayRankTransform(arr) {
FILE: coding_interviews/leetcode/easy/ransom-note/ransom-note.js
function canConstruct (line 1) | function canConstruct(ransomNote, magazine) {
FILE: coding_interviews/leetcode/easy/ransom_note/ransom_note.py
function can_construct (line 1) | def can_construct(ransom_note, magazine):
FILE: coding_interviews/leetcode/easy/reduce_zero/reduce_zero.py
function reduce_number (line 4) | def reduce_number(num):
function number_of_steps (line 11) | def number_of_steps(num):
FILE: coding_interviews/leetcode/easy/reformat-date/reformat-date.js
function getDateInfo (line 3) | function getDateInfo(date) {
function formatDay (line 37) | function formatDay(day) {
function reformatDate (line 41) | function reformatDate(date) {
FILE: coding_interviews/leetcode/easy/reformat-phone-number/reformat-phone-number.js
function removeSpacesAndDashes (line 1) | function removeSpacesAndDashes(number) {
function reformatNumber (line 5) | function reformatNumber(number) {
FILE: coding_interviews/leetcode/easy/relative-ranks/relative-ranks.js
function sortDesc (line 1) | function sortDesc(list) {
function buildHashmap (line 11) | function buildHashmap(list) {
function getRelativeRanks (line 21) | function getRelativeRanks(score, hashmap) {
function findRelativeRanks (line 31) | function findRelativeRanks(score) {
FILE: coding_interviews/leetcode/easy/remove-duplicates-from-sorted-list/remove-duplicates-from-sorted-list.js
function deleteDuplicates (line 1) | function deleteDuplicates(head) {
FILE: coding_interviews/leetcode/easy/remove-linked-list-elements/remove-linked-list-elements.js
function removeElements (line 1) | function removeElements(head, val) {
FILE: coding_interviews/leetcode/easy/remove-outermost-parentheses/remove-outermost-parentheses.js
function removeOuterParentheses (line 1) | function removeOuterParentheses(string) {
FILE: coding_interviews/leetcode/easy/remove-palindromic-subsequences/remove-palindromic-subsequences.js
function isPalindrome (line 1) | function isPalindrome(s) {
function removePalindromeSub (line 5) | function removePalindromeSub(s) {
FILE: coding_interviews/leetcode/easy/remove-trailing-zeros-from-a-string/remove-trailing-zeros-from-a-string.js
function removeTrailingZeros (line 1) | function removeTrailingZeros(num) {
FILE: coding_interviews/leetcode/easy/remove_duplicates.py
function remove_duplicates (line 11) | def remove_duplicates(nums):
FILE: coding_interviews/leetcode/easy/remove_duplicates/remove_duplicates.py
function remove_duplicates (line 3) | def remove_duplicates(S):
function remove_duplicates (line 22) | def remove_duplicates(S):
FILE: coding_interviews/leetcode/easy/remove_duplicates_from_list.py
class ListNode (line 3) | class ListNode(object):
method __init__ (line 4) | def __init__(self, value):
function remove_duplicates (line 8) | def remove_duplicates(head):
FILE: coding_interviews/leetcode/easy/remove_element.py
function remove_element (line 10) | def remove_element(nums, val):
FILE: coding_interviews/leetcode/easy/replace_digits/replace_digits.py
function replace_digits (line 3) | def replace_digits(s):
function shift (line 14) | def shift(char, digit):
FILE: coding_interviews/leetcode/easy/replace_elements/replace_elements.py
function replace_elements (line 3) | def replace_elements(arr):
FILE: coding_interviews/leetcode/easy/reshape-the-matrix/reshape-the-matrix.js
function matrixReshape (line 1) | function matrixReshape(mat, r, c) {
FILE: coding_interviews/leetcode/easy/reverse-linked-list/reverse-linked-list.js
function reverseList (line 1) | function reverseList(head) {
function reverseListSimpler (line 23) | function reverseListSimpler(head) {
FILE: coding_interviews/leetcode/easy/reverse-only-letters/reverse-only-letters.js
function isEnglishLetter (line 1) | function isEnglishLetter(char) {
function reverseOnlyLetters (line 8) | function reverseOnlyLetters(s) {
FILE: coding_interviews/leetcode/easy/reverse-prefix-of-word/reverse-prefix-of-word.js
function reverse (line 1) | function reverse(charsList) {
function reversePrefix (line 11) | function reversePrefix(word, char) {
FILE: coding_interviews/leetcode/easy/reverse-string/reverse-string-in-place.js
function reverseString (line 1) | function reverseString(s) {
FILE: coding_interviews/leetcode/easy/reverse-string/reverse-string.js
function reverseString (line 1) | function reverseString(s) {
FILE: coding_interviews/leetcode/easy/reverse-vowels-of-a-string/reverse-vowels-of-a-string.js
function reverseVowels (line 1) | function reverseVowels(s) {
FILE: coding_interviews/leetcode/easy/reverse-words-in-a-string-iii/reverse-words-in-a-string-iii.js
function reverseWords (line 1) | function reverseWords(s) {
FILE: coding_interviews/leetcode/easy/reverse_integer.py
function reverse (line 3) | def reverse(x):
FILE: coding_interviews/leetcode/easy/reverse_string.py
function reverse_string (line 8) | def reverse_string(s):
FILE: coding_interviews/leetcode/easy/reverse_vowels.py
function vowel (line 11) | def vowel(char):
function reverse_vowels (line 14) | def reverse_vowels(s):
FILE: coding_interviews/leetcode/easy/reverse_words_string.py
function reverse_words (line 8) | def reverse_words(s):
FILE: coding_interviews/leetcode/easy/rings-and-rods/rings-and-rods.js
function countPoints (line 19) | function countPoints(rings = '') {
FILE: coding_interviews/leetcode/easy/root-equals-sum-of-children/index.js
function checkTree (line 1) | function checkTree(root) {
FILE: coding_interviews/leetcode/easy/row-with-maximum-ones/row-with-maximum-ones.js
function rowAndMaximumOnes (line 3) | function rowAndMaximumOnes(mat) {
FILE: coding_interviews/leetcode/easy/running_array_sum/running_array_sum.py
function running_sum (line 1) | def running_sum(nums):
FILE: coding_interviews/leetcode/easy/same-tree/same-tree.js
function isSameTree (line 1) | function isSameTree(p, q) {
FILE: coding_interviews/leetcode/easy/same_tree.py
function is_same_tree (line 3) | def is_same_tree(p, q):
function is_same_tree (line 12) | def is_same_tree(p, q):
FILE: coding_interviews/leetcode/easy/search-in-a-binary-search-tree/search-in-a-binary-search-tree.js
function searchBST (line 1) | function searchBST(root, val) {
FILE: coding_interviews/leetcode/easy/search-insert-position/search-insert-position-new.js
function getMiddle (line 1) | function getMiddle(start, end) {
function searchInsert (line 5) | function searchInsert(nums, target) {
FILE: coding_interviews/leetcode/easy/search_in_a_binary_search_tree/search_in_a_binary_search_tree.py
function searchBST (line 3) | def searchBST(root, val):
FILE: coding_interviews/leetcode/easy/second-largest-digit-in-a-string/second-largest-digit-in-a-string.js
function secondHighest (line 3) | function secondHighest(s) {
FILE: coding_interviews/leetcode/easy/self_dividing_numbers.py
function self_dividing_numbers (line 8) | def self_dividing_numbers(left, right):
function dividing (line 12) | def dividing(number, original):
FILE: coding_interviews/leetcode/easy/semi-ordered-permutation/semi-ordered-permutation.js
function semiOrderedPermutation (line 3) | function semiOrderedPermutation(nums) {
FILE: coding_interviews/leetcode/easy/separate-the-digits-in-an-array/separate-the-digits-in-an-array.js
function separateDigits (line 1) | function separateDigits(nums) {
FILE: coding_interviews/leetcode/easy/shortest_to_char/shortest_to_char.py
function shortest_to_char (line 3) | def shortest_to_char(s, c):
function shortest_to_char (line 25) | def shortest_to_char(s, c):
FILE: coding_interviews/leetcode/easy/shuffle_string/shuffle_string.py
function restore_string (line 5) | def restore_string(s, indices):
FILE: coding_interviews/leetcode/easy/shuffle_the_array/shuffle_the_array.py
function shuffle (line 1) | def shuffle(nums, n):
FILE: coding_interviews/leetcode/easy/sign_of_the_product_of_an_array/sign_of_the_product_of_an_array.py
function array_sign (line 3) | def array_sign(nums):
FILE: coding_interviews/leetcode/easy/single-number/single-number.js
function singleNumber (line 1) | function singleNumber(nums) {
FILE: coding_interviews/leetcode/easy/single_number/single_number.py
function single_number (line 3) | def single_number(nums):
FILE: coding_interviews/leetcode/easy/slowest-key/slowest-key.js
function isLexicographicallyLarger (line 1) | function isLexicographicallyLarger(keysPressed, keyPressedIndex, index) {
function slowestKey (line 5) | function slowestKey(releaseTimes, keysPressed) {
function slowestKey (line 33) | function slowestKey(releaseTimes, keysPressed) {
FILE: coding_interviews/leetcode/easy/smallest-even-multiple/smallest-even-multiple.js
function smallestEvenMultiple (line 1) | function smallestEvenMultiple(n) {
FILE: coding_interviews/leetcode/easy/smallest-index-with-equal-value/smallest-index-with-equal-value.js
function smallestEqual (line 1) | function smallestEqual(nums) {
FILE: coding_interviews/leetcode/easy/smallest-range-i/optimized-smallest-range-i.js
function minMax (line 3) | function minMax(nums) {
function smallestRangeI (line 15) | function smallestRangeI(nums, k) {
FILE: coding_interviews/leetcode/easy/smallest-range-i/smallest-range-i.js
function smallestRangeI (line 3) | function smallestRangeI(nums, k) {
FILE: coding_interviews/leetcode/easy/smallest-range-i/smallest-range-iI.js
function smallestRangeI (line 3) | function smallestRangeI(nums, k) {
FILE: coding_interviews/leetcode/easy/smallest_numbers/smallest_numbers.py
function smaller_numbers_than_current (line 17) | def smaller_numbers_than_current(nums):
function smaller_numbers_than_current_2 (line 37) | def smaller_numbers_than_current_2(nums):
FILE: coding_interviews/leetcode/easy/sort-array-by-increasing-frequency/sort-array-by-increasing-frequency.js
function buildCounter (line 1) | function buildCounter(nums) {
function toPairs (line 12) | function toPairs(counter) {
function byCount (line 22) | function byCount(pair1, pair2) {
function buildResult (line 30) | function buildResult(pairs) {
function frequencySort (line 42) | function frequencySort(nums) {
FILE: coding_interviews/leetcode/easy/sort-array-by-parity-ii/sort-array-by-parity-ii.js
function isEven (line 1) | function isEven(num) {
function separateIntoEvensAndOdds (line 5) | function separateIntoEvensAndOdds(nums) {
function sortArrayByParityII (line 17) | function sortArrayByParityII(nums) {
function sortArrayByParityIIInPlace (line 29) | function sortArrayByParityIIInPlace(nums) {
FILE: coding_interviews/leetcode/easy/sort-array-by-parity/sort-array-by-parity-two-loops.js
function sortArrayByParity (line 3) | function sortArrayByParity(nums) {
FILE: coding_interviews/leetcode/easy/sort-array-by-parity/sort-array-by-parity.js
function sortArrayByParity (line 3) | function sortArrayByParity(nums) {
FILE: coding_interviews/leetcode/easy/sort-even-and-odd-indices-independently/sort-even-and-odd-indices-independently.js
function decreasing (line 1) | function decreasing(a, b) {
function increasing (line 5) | function increasing(a, b) {
function sortEvenOdd (line 9) | function sortEvenOdd(nums) {
FILE: coding_interviews/leetcode/easy/sort-integers-by-the-number-of-1-bits/sort-integers-by-the-number-of-1-bits.js
function toBinary (line 1) | function toBinary(num) {
function byNumberOfOneBits (line 18) | function byNumberOfOneBits(binary1, binary2) {
function sortByBits (line 29) | function sortByBits(nums) {
FILE: coding_interviews/leetcode/easy/sort-the-people/sort-the-people.js
function sortPeople (line 1) | function sortPeople(names, heights) {
FILE: coding_interviews/leetcode/easy/sort_array_by_parity/sort_array_by_parity.py
function sort_array_by_parity (line 16) | def sort_array_by_parity(A):
FILE: coding_interviews/leetcode/easy/sort_sentence/sort_sentence.py
function sort_sentence (line 3) | def sort_sentence(s):
FILE: coding_interviews/leetcode/easy/special-positions-in-a-binary-matrix/special-positions-in-a-binary-matrix-cache.js
function countOnesInRow (line 1) | function countOnesInRow(matrix, row) {
function countOnesInCol (line 11) | function countOnesInCol(matrix, col) {
function numSpecial (line 21) | function numSpecial(matrix) {
FILE: coding_interviews/leetcode/easy/special-positions-in-a-binary-matrix/special-positions-in-a-binary-matrix.js
function countOnesInRow (line 1) | function countOnesInRow(matrix, row) {
function countOnesInCol (line 11) | function countOnesInCol(matrix, col) {
function numSpecial (line 21) | function numSpecial(matrix) {
FILE: coding_interviews/leetcode/easy/split-strings-by-separator/split-strings-by-separator.js
function splitWordsBySeparator (line 3) | function splitWordsBySeparator(words, separator) {
FILE: coding_interviews/leetcode/easy/split-with-minimum-sum/split-with-minimum-sum.js
function splitNum (line 1) | function splitNum(num) {
FILE: coding_interviews/leetcode/easy/split_string_in_balanced_strings/split_string_in_balanced_strings.py
function balanced_string_split (line 4) | def balanced_string_split(s):
FILE: coding_interviews/leetcode/easy/squares-of-a-sorted-array/squares-of-a-sorted-array-on.js
function buildArray (line 1) | function buildArray(n) {
function sortedSquares (line 11) | function sortedSquares(nums) {
FILE: coding_interviews/leetcode/easy/squares-of-a-sorted-array/squares-of-a-sorted-array.js
function square (line 1) | function square(num) {
function byIncreasingOrder (line 5) | function byIncreasingOrder(num1, num2) {
function sortedSquares (line 9) | function sortedSquares(nums) {
FILE: coding_interviews/leetcode/easy/squares_of_a_sorted_array/squares_of_a_sorted_array.py
function squares_of_a_sorted_array (line 17) | def squares_of_a_sorted_array(A):
function squares_of_a_sorted_array_in_place (line 26) | def squares_of_a_sorted_array_in_place(A):
FILE: coding_interviews/leetcode/easy/str_str/str_str.py
function strStr (line 20) | def strStr(haystack, needle):
FILE: coding_interviews/leetcode/easy/string-matching-in-an-array/string-matching-in-an-array.js
function isSubstring (line 1) | function isSubstring(subword, word) {
function addSubstring (line 11) | function addSubstring(word1, word2, answer) {
function stringMatching (line 19) | function stringMatching(words) {
FILE: coding_interviews/leetcode/easy/subarrays-distinct-element-sum-of-squares-i/subarrays-distinct-element-sum-of-squares-i.js
function sumCounts (line 3) | function sumCounts(nums) {
FILE: coding_interviews/leetcode/easy/subdomain_visit_count.py
function update_subdomain_counter (line 13) | def update_subdomain_counter(sc, s, c):
function subdomain_visits (line 19) | def subdomain_visits(cpdomains):
FILE: coding_interviews/leetcode/easy/substrings-of-size-three-with-distinct-characters/substrings-of-size-three-with-distinct-characters.js
function isGoodString (line 1) | function isGoodString(string) {
function countGoodSubstrings (line 6) | function countGoodSubstrings(string) {
FILE: coding_interviews/leetcode/easy/subtract_product_and_sum/subtract_product_and_sum.py
function subtract_product_and_sum (line 15) | def subtract_product_and_sum(num):
FILE: coding_interviews/leetcode/easy/subtree-of-another-tree/subtree-of-another-tree.js
function isSame (line 1) | function isSame(root, subRoot) {
function isSubtree (line 7) | function isSubtree(root, subRoot) {
FILE: coding_interviews/leetcode/easy/sum-multiples/sum-multiples.js
function sumOfMultiples (line 1) | function sumOfMultiples(n) {
FILE: coding_interviews/leetcode/easy/sum-of-all-subset-xor-totals/sum-of-all-subset-xor-totals.js
function getAllSubsets (line 1) | function getAllSubsets(subset, nums, output, index) {
function calculateTotalXOR (line 12) | function calculateTotalXOR(nums) {
function subsetXORSum (line 22) | function subsetXORSum(nums) {
FILE: coding_interviews/leetcode/easy/sum-of-digits-in-base-k/sum-of-digits-in-base-k.js
function fromDecimalToK (line 1) | function fromDecimalToK(n, k) {
function sumBase (line 12) | function sumBase(n, k) {
FILE: coding_interviews/leetcode/easy/sum-of-digits-of-string-after-convert/sum-of-digits-of-string-after-convert.js
function toNum (line 1) | function toNum(char) {
function getNumbers (line 5) | function getNumbers(s) {
function sum (line 15) | function sum(charNums) {
function getLucky (line 22) | function getLucky(s, k) {
FILE: coding_interviews/leetcode/easy/sum-of-left-leaves/sum-of-left-leaves.js
function sumOfLeftLeaves (line 1) | function sumOfLeftLeaves(root, isLeft = false) {
FILE: coding_interviews/leetcode/easy/sum-of-squares-of-special-elements/sum-of-squares-of-special-elements.js
function sumOfSquares (line 3) | function sumOfSquares(nums) {
FILE: coding_interviews/leetcode/easy/sum-of-values-at-indices-with-k-set-bits/sum-of-values-at-indices-with-k-set-bits.js
function toBinary (line 1) | function toBinary(num) {
function checkSetBits (line 14) | function checkSetBits(binary, k) {
function sumIndicesWithKSetBits (line 24) | function sumIndicesWithKSetBits(nums, k) {
FILE: coding_interviews/leetcode/easy/sum_leaf_binary_numbers/sum_leaf_binary_numbers.py
function sum_root_to_leaf (line 5) | def sum_root_to_leaf(root):
function helper (line 10) | def helper(node, path):
FILE: coding_interviews/leetcode/easy/sum_of_all_odd_length_subarrays/sum_of_all_odd_length_subarrays.py
function sum_odd_length_subarrays (line 8) | def sum_odd_length_subarrays(arr):
function sum_odd_length_subarrays_optimized (line 24) | def sum_odd_length_subarrays_optimized(A):
FILE: coding_interviews/leetcode/easy/sum_of_unique_elements/sum_of_unique_elements.py
function sum_of_unique (line 4) | def sum_of_unique(nums):
FILE: coding_interviews/leetcode/easy/sum_zero/sum_zero.py
function sum_zero (line 1) | def sum_zero(n):
FILE: coding_interviews/leetcode/easy/symmetric-tree/symmetric-tree.js
function symmetricNodes (line 1) | function symmetricNodes(node1, node2) {
function isSymmetric (line 17) | function isSymmetric(root) {
FILE: coding_interviews/leetcode/easy/take-gifts-from-the-richest-pile/take-gifts-from-the-richest-pile.js
function pickGifts (line 1) | function pickGifts(gifts, k) {
FILE: coding_interviews/leetcode/easy/three-consecutive-odds/three-consecutive-odds.js
function threeConsecutiveOdds (line 1) | function threeConsecutiveOdds(nums) {
FILE: coding_interviews/leetcode/easy/time-needed-to-buy-tickets/time-needed-to-buy-tickets.js
function timeRequiredToBuy (line 1) | function timeRequiredToBuy(tickets, k) {
FILE: coding_interviews/leetcode/easy/to_lower_case/to_lower_case.py
function lower_case_char (line 21) | def lower_case_char(char):
function lower_case (line 28) | def lower_case(str):
FILE: coding_interviews/leetcode/easy/toeplitz-matrix/toeplitz-matrix.js
function isDiagonalToeplitz (line 1) | function isDiagonalToeplitz(matrix, value, row, col) {
function isToeplitzMatrix (line 7) | function isToeplitzMatrix(matrix) {
FILE: coding_interviews/leetcode/easy/transpose-matrix/transpose-matrix.js
function transpose (line 1) | function transpose(matrix) {
FILE: coding_interviews/leetcode/easy/truncate_sentence/truncate_sentence.py
function truncate_sentence (line 3) | def truncate_sentence(s, k):
function truncate_sentence (line 22) | def truncate_sentence(s, k):
function truncate_sentence (line 36) | def truncate_sentence(s, k):
FILE: coding_interviews/leetcode/easy/two-furthest-houses-with-different-colors/two-furthest-houses-with-different-colors.js
function maxDistance (line 1) | function maxDistance(colors) {
FILE: coding_interviews/leetcode/easy/two-out-of-three/two-out-of-three.js
function buildHashmap (line 1) | function buildHashmap(nums) {
function checkAndAddNumbers (line 11) | function checkAndAddNumbers(result, hashmap1, hashmap2, hashmap3) {
function twoOutOfThree (line 19) | function twoOutOfThree(nums1, nums2, nums3) {
FILE: coding_interviews/leetcode/easy/two-sum-iv-input-is-a-bst/two-sum-iv-input-is-a-bst.js
function dfs (line 1) | function dfs(node, hashmap, values) {
function findTarget (line 13) | function findTarget(root, k) {
function dfs2 (line 30) | function dfs2(node, target, hashmap) {
function findTarget2 (line 44) | function findTarget2(root, k) {
FILE: coding_interviews/leetcode/easy/two-sum/two-sum.js
function twoSum (line 1) | function twoSum(nums, target) {
FILE: coding_interviews/leetcode/easy/two_sum.py
function two_sum (line 3) | def two_sum(nums, target):
FILE: coding_interviews/leetcode/easy/uncommon-words-from-two-sentences/uncommon-words-from-two-sentences.js
function buildCounter (line 1) | function buildCounter(sentence) {
function getOnceWords (line 12) | function getOnceWords(counter) {
function getUncommonWords (line 22) | function getUncommonWords(onceWords, map) {
function uncommonFromSentences (line 26) | function uncommonFromSentences(s1, s2) {
FILE: coding_interviews/leetcode/easy/unique-number-of-occurrences/unique-number-of-occurrences.js
function uniqueOccurrences (line 1) | function uniqueOccurrences(arr) {
FILE: coding_interviews/leetcode/easy/unique_morse_code_words.py
function unique_morse_representations (line 8) | def unique_morse_representations(words):
FILE: coding_interviews/leetcode/easy/unique_number_of_occurrences/unique_number_of_occurrences.py
function unique_occurrences (line 3) | def unique_occurrences(arr):
function unique_occurrences_2 (line 16) | def unique_occurrences_2(arr):
FILE: coding_interviews/leetcode/easy/univalued-binary-tree/univalued-binary-tree.js
function isUnivalTree (line 1) | function isUnivalTree(root) {
function isUnivalTree (line 15) | function isUnivalTree(root, value = root.val) {
FILE: coding_interviews/leetcode/easy/valid-anagram/valid-anagram.js
function isAnagram (line 1) | function isAnagram(s, t) {
FILE: coding_interviews/leetcode/easy/valid-palindrome/valid-palindrome-2.js
function isPalindrome (line 1) | function isPalindrome(s) {
FILE: coding_interviews/leetcode/easy/valid-palindrome/valid-palindrome.js
function downcase (line 3) | function downcase(string) {
function keepAlphanumeric (line 7) | function keepAlphanumeric(string) {
function isValidPalindrome (line 19) | function isValidPalindrome(string) {
function isPalindrome (line 35) | function isPalindrome(string) {
FILE: coding_interviews/leetcode/easy/valid-palindrome/valid_palindrome.py
function is_palindrome (line 17) | def is_palindrome(string):
function build_new_string_variation (line 21) | def build_new_string_variation(string, index):
function valid_palindrome (line 25) | def valid_palindrome(string):
function valid_palindrome_2 (line 53) | def valid_palindrome_2(string):
FILE: coding_interviews/leetcode/easy/valid-parentheses/valid-parentheses.js
function matches (line 1) | function matches(openBracket, closingBracket) {
function isValid (line 11) | function isValid(s) {
FILE: coding_interviews/leetcode/easy/water-bottles/water-bottles.js
function numWaterBottles (line 1) | function numWaterBottles(numBottles, numExchange) {
FILE: coding_interviews/leetcode/easy/weakest_rows/weakest_rows.py
function k_weakest_rows (line 3) | def k_weakest_rows(mat, k):
FILE: coding_interviews/leetcode/easy/xor-operation-in-an-array/xor-operation-in-an-array.js
function xorOperation (line 1) | function xorOperation(n, start) {
FILE: coding_interviews/leetcode/medium/3sum/3sum-tle.js
function sortTriplet (line 1) | function sortTriplet(num1, num2, num3) {
function getSortedTripletString (line 5) | function getSortedTripletString(num1, num2, num3) {
function threeSum (line 10) | function threeSum(nums) {
FILE: coding_interviews/leetcode/medium/add_two_numbers/add_two_numbers.py
class ListNode (line 8) | class ListNode(object):
method __init__ (line 9) | def __init__(self, x):
function add_two_numbers (line 13) | def add_two_numbers(l1, l2):
FILE: coding_interviews/leetcode/medium/all_elements_in_two_binary_search_trees/all_elements_in_two_binary_search_trees.py
function get_all_elements (line 4) | def get_all_elements(root1, root2):
function get_sorted_list (line 11) | def get_sorted_list(node, values):
function get_sorted_elements_from (line 22) | def get_sorted_elements_from(node):
function get_all_elements (line 39) | def get_all_elements(root1, root2):
function get_sorted_elements_from (line 67) | def get_sorted_elements_from(node, elements):
function get_all_elements (line 73) | def get_all_elements(root1, root2):
FILE: coding_interviews/leetcode/medium/arithmetic-subarrays/arithmetic-subarrays.py
function check_arithmetic_subarrays (line 3) | def check_arithmetic_subarrays(nums, l, r):
FILE: coding_interviews/leetcode/medium/balance-a-binary-search-tree/balance-a-binary-search-tree.js
function inorder (line 1) | function inorder(root, nodes) {
function toBST (line 7) | function toBST(start, end, nodes) {
function balanceBST (line 19) | function balanceBST(root) {
FILE: coding_interviews/leetcode/medium/binary-tree-inorder-traversal/binary-tree-inorder-traversal.py
class Solution (line 3) | class Solution:
method __init__ (line 4) | def __init__(self):
method inorder_traversal (line 7) | def inorder_traversal(self, root):
FILE: coding_interviews/leetcode/medium/binary-tree-level-order-traversal/binary-tree-level-order-traversal.js
function levelOrder (line 1) | function levelOrder(root) {
FILE: coding_interviews/leetcode/medium/bst_from_pre_order_traversal/bst_from_pre_order_traversal.py
class TreeNode (line 1) | class TreeNode:
method __init__ (line 2) | def __init__(self, val=0, left=None, right=None):
function bst_from_preorder (line 8) | def bst_from_preorder(preorder):
function helper (line 17) | def helper(node, value):
FILE: coding_interviews/leetcode/medium/bst_to_greatest/bst_to_greatest.py
function sum_and_list (line 1) | def sum_and_list(node, total, values):
function modify_helper (line 19) | def modify_helper(node, mapper):
function bst_to_gst (line 30) | def bst_to_gst(root):
function bst_to_gst (line 46) | def bst_to_gst(node):
FILE: coding_interviews/leetcode/medium/clone-graph/clone-graph.js
function cloneGraph (line 9) | function cloneGraph(node) {
FILE: coding_interviews/leetcode/medium/cloned_binary_tree/cloned_binary_tree.py
function get_target_copy (line 4) | def get_target_copy(original, cloned, target):
FILE: coding_interviews/leetcode/medium/count-nodes-equal-to-average-of-subtree/count-nodes-equal-to-average-of-subtree.js
function calculateAverage (line 1) | function calculateAverage(totalValue, nodesCount) {
function averageHelper (line 5) | function averageHelper(node, count) {
function averageOfSubtree (line 30) | function averageOfSubtree(root) {
FILE: coding_interviews/leetcode/medium/count-number-of-distinct-integers-after-reverse-operations/count-number-of-distinct-integers-after-reverse-operations-numbers.js
function reverseDigits (line 3) | function reverseDigits(num) {
function countDistinctIntegers (line 14) | function countDistinctIntegers(nums) {
FILE: coding_interviews/leetcode/medium/count-number-of-distinct-integers-after-reverse-operations/count-number-of-distinct-integers-after-reverse-operations.js
function reverseDigits (line 3) | function reverseDigits(num) {
function countDistinctIntegers (line 14) | function countDistinctIntegers(nums) {
FILE: coding_interviews/leetcode/medium/count-sorted-vowel-strings/count-sorted-vowel-strings.js
function countVowelStrings (line 1) | function countVowelStrings(n) {
FILE: coding_interviews/leetcode/medium/count-sub-islands/count-sub-islands-tle.js
function isInsideTheGrid (line 11) | function isInsideTheGrid(grid, row, col) {
function dfs (line 15) | function dfs(grid, row, col) {
function countSubIslands (line 35) | function countSubIslands(grid1, grid2) {
FILE: coding_interviews/leetcode/medium/count-sub-islands/count-sub-islands.js
function dfs (line 1) | function dfs(grid1, grid2, row, col) {
function countSubIslands (line 24) | function countSubIslands(grid1, grid2) {
FILE: coding_interviews/leetcode/medium/count_points/count_points.py
function is_point_within_circuference (line 3) | def is_point_within_circuference(qx, qy, qr, px, py):
function count_points (line 6) | def count_points(points, queries):
FILE: coding_interviews/leetcode/medium/counter_number_of_teams/counter_number_of_teams.py
function num_teams (line 1) | def num_teams(rating):
function num_teams (line 14) | def num_teams(rating):
FILE: coding_interviews/leetcode/medium/deck_revealed_increasing/deck_revealed_increasing.py
function deck_revealed_increasing (line 5) | def deck_revealed_increasing(deck):
FILE: coding_interviews/leetcode/medium/decode-string/decode-string.js
function decodeString (line 3) | function decodeString(encodedString) {
FILE: coding_interviews/leetcode/medium/deepest_leaves_sum/deepest_leaves_sum.py
function sum_deepest_leaves (line 11) | def sum_deepest_leaves(root):
function helper (line 29) | def helper(node, mapper, level):
FILE: coding_interviews/leetcode/medium/delete-node-in-a-linked-list/better-delete-node-in-a-linked-list.js
function deleteNode (line 12) | function deleteNode(node) {
FILE: coding_interviews/leetcode/medium/delete-node-in-a-linked-list/delete-node-in-a-linked-list.js
function deleteNode (line 12) | function deleteNode(node) {
FILE: coding_interviews/leetcode/medium/design-add-and-search-words-data-structure/design-add-and-search-words-data-structure.js
function isTheSame (line 1) | function isTheSame(word, wordFromDict) {
FILE: coding_interviews/leetcode/medium/difference-between-ones-and-zeros-in-row-and-column/difference-between-ones-and-zeros-in-row-and-column.js
function traverseGridRow (line 1) | function traverseGridRow(grid, row) {
function traverseGridCol (line 17) | function traverseGridCol(grid, col) {
function onesMinusZeros (line 33) | function onesMinusZeros(grid) {
FILE: coding_interviews/leetcode/medium/encode_and_decode_tinyurl/encode_and_decode_tinyurl.py
class Codec (line 3) | class Codec:
method encode (line 9) | def encode(self, longUrl: str) -> str:
method decode (line 19) | def decode(self, shortUrl: str) -> str:
FILE: coding_interviews/leetcode/medium/execution-of-all-suffix-instructions-staying-in-a-grid/execution-of-all-suffix-instructions-staying-in-a-grid.js
function isOffGrid (line 3) | function isOffGrid(row, col, n) {
function executeInstructions (line 7) | function executeInstructions(n, startPos, s) {
FILE: coding_interviews/leetcode/medium/find-the-original-array-of-prefix-xor/find-the-original-array-of-prefix-xor.js
function findArray (line 1) | function findArray(pref) {
FILE: coding_interviews/leetcode/medium/find-the-winner-of-the-circular-game/find-the-winner-of-the-circular-game.js
function toArray (line 3) | function toArray(n) {
function findTheWinner (line 13) | function findTheWinner(n, k) {
FILE: coding_interviews/leetcode/medium/find-the-winner-of-the-circular-game/queue-find-the-winner-of-the-circular-game.js
function buildQueue (line 3) | function buildQueue(n) {
function findTheWinner (line 13) | function findTheWinner(n, k) {
FILE: coding_interviews/leetcode/medium/find-triangular-sum-of-an-array/find-triangular-sum-of-an-array.js
function calculate (line 1) | function calculate(num1, num2) {
function triangularSum (line 5) | function triangularSum(nums) {
FILE: coding_interviews/leetcode/medium/find-valid-matrix-given-row-and-column-sums/find-valid-matrix-given-row-and-column-sums.js
function buildMatrix (line 1) | function buildMatrix(rows, cols) {
function restoreMatrix (line 17) | function restoreMatrix(rowSum, colSum) {
FILE: coding_interviews/leetcode/medium/find_and_replace_pattern/find_and_replace_pattern.py
function find_and_replace_pattern (line 3) | def find_and_replace_pattern(words, pattern):
FILE: coding_interviews/leetcode/medium/finding_pairs_with_a_certain_sum/finding_pairs_with_a_certain_sum.py
class FindSumPairs (line 3) | class FindSumPairs:
method __init__ (line 4) | def __init__(self, nums1, nums2):
method add (line 9) | def add(self, index, val):
method count (line 14) | def count(self, total):
FILE: coding_interviews/leetcode/medium/finding_the_users_active_minutes/finding_the_users_active_minutes.py
function build_unique_actions_by_id (line 3) | def build_unique_actions_by_id(logs):
function build_count_by_actions_number (line 14) | def build_count_by_actions_number(unique_actions_by_id):
function build_answer (line 25) | def build_answer(count_by_actions_number, k):
function finding_users_active_minutes (line 36) | def finding_users_active_minutes(logs, k):
function finding_users_active_minutes (line 43) | def finding_users_active_minutes(logs, k):
FILE: coding_interviews/leetcode/medium/fraction_to_decimal/fraction_to_decimal.py
function fraction_to_decimal (line 1) | def fraction_to_decimal(numerator, denominator):
FILE: coding_interviews/leetcode/medium/group-anagrams/group-anagrams.js
function sort (line 1) | function sort(string) {
function groupAnagrams (line 5) | function groupAnagrams(strs) {
FILE: coding_interviews/leetcode/medium/group_the_people/group_the_people.py
function group_the_people (line 4) | def group_the_people(groupSizes):
FILE: coding_interviews/leetcode/medium/insert-greatest-common-divisors-in-linked-list/insert-greatest-common-divisors-in-linked-list.js
function calculateGCD (line 11) | function calculateGCD(x, y) {
function insertGreatestCommonDivisors (line 22) | function insertGreatestCommonDivisors(head) {
FILE: coding_interviews/leetcode/medium/insert-into-a-binary-search-tree/insert-into-a-binary-search-tree.js
function insertIntoBST (line 1) | function insertIntoBST(root, val) {
FILE: coding_interviews/leetcode/medium/insert_bst/insert_bst.py
class TreeNode (line 1) | class TreeNode:
method __init__ (line 2) | def __init__(self, val=0, left=None, right=None):
function insert_into_BST (line 8) | def insert_into_BST(root, val):
FILE: coding_interviews/leetcode/medium/keep_city_skyline/keep_city_skyline.py
function build_top_or_bottom (line 6) | def build_top_or_bottom(grid):
function build_left_or_right (line 20) | def build_left_or_right(grid):
function max_increase_keeping_skyline (line 34) | def max_increase_keeping_skyline(grid):
FILE: coding_interviews/leetcode/medium/kth-smallest-element-in-a-bst/kth-smallest-element-in-a-bst-1.js
function traverse (line 1) | function traverse(node, list) {
function kthSmallest (line 12) | function kthSmallest(root, k) {
FILE: coding_interviews/leetcode/medium/kth-smallest-element-in-a-bst/kth-smallest-element-in-a-bst-2.js
function traverseAndGetKthSmallest (line 4) | function traverseAndGetKthSmallest(node, k) {
function kthSmallest (line 17) | function kthSmallest(root, k) {
FILE: coding_interviews/leetcode/medium/kth-smallest-element-in-a-bst/kth-smallest-element-in-a-bst.js
function traverse (line 4) | function traverse(node, list) {
function kthSmallest (line 15) | function kthSmallest(root, k) {
function traverseAndGetKthSmallest (line 26) | function traverseAndGetKthSmallest(node, k) {
function kthSmallest (line 39) | function kthSmallest(root, k) {
FILE: coding_interviews/leetcode/medium/letter_tile_possibilities/letter_tile_possibilities.py
function num_tile_possibilities (line 3) | def num_tile_possibilities(tiles):
FILE: coding_interviews/leetcode/medium/longest-substring-without-repeating-characters/longest-substring-without-repeating-characters.js
function lengthOfLongestSubstring (line 13) | function lengthOfLongestSubstring(s) {
FILE: coding_interviews/leetcode/medium/max-area-of-island/max-area-of-island.js
function isOffTheGrid (line 1) | function isOffTheGrid(grid, row, col) {
function dfs (line 7) | function dfs(grid, row, col, maximumLocalIslandArea = 0) {
function maxAreaOfIsland (line 23) | function maxAreaOfIsland(grid) {
FILE: coding_interviews/leetcode/medium/max_coins/max_coins.py
function max_coins (line 4) | def max_coins(piles):
FILE: coding_interviews/leetcode/medium/maximum-sum-of-an-hourglass/maximum-sum-of-an-hourglass.js
function maxRowSum (line 3) | function maxRowSum(grid, row, col) {
function maxSum (line 15) | function maxSum(grid) {
FILE: coding_interviews/leetcode/medium/maximum_binary_tree/maximum_binary_tree.py
class TreeNode (line 16) | class TreeNode(object):
method __init__ (line 17) | def __init__(self, x):
function construct_maximum_binary_tree (line 22) | def construct_maximum_binary_tree(nums):
FILE: coding_interviews/leetcode/medium/median_tree/median_tree.py
class Node (line 1) | class Node:
method __init__ (line 2) | def __init__(self, value, left, right):
function sum_and_count_nodes (line 8) | def sum_and_count_nodes(node, sum_of_values, count):
function median (line 17) | def median(tree):
FILE: coding_interviews/leetcode/medium/merge-nodes-in-between-zeros/merge-nodes-in-between-zeros.js
class ListNode (line 1) | class ListNode {
method constructor (line 2) | constructor(val, next) {
function mergeNodes (line 8) | function mergeNodes(head) {
FILE: coding_interviews/leetcode/medium/merge-nodes-in-between-zeros/tests/merge-nodes-in-between-zeros.test.js
function buildList (line 4) | function buildList(nums, initValue = 0) {
FILE: coding_interviews/leetcode/medium/min-cost-climbing-stairs/min-cost-climbing-stairs.js
function getMinCost (line 4) | function getMinCost(stairs, index, dp) {
function minCostClimbingStairs (line 19) | function minCostClimbingStairs(cost) {
FILE: coding_interviews/leetcode/medium/min_operations/min_operations.py
function min_operations (line 1) | def min_operations(n):
FILE: coding_interviews/leetcode/medium/min_pair_sum/min_pair_sum.py
function min_pair_sum (line 3) | def min_pair_sum(nums):
FILE: coding_interviews/leetcode/medium/min_partitions/min_partitions.py
function min_partitions (line 3) | def min_partitions(n):
function min_partitions (line 12) | def min_partitions(n):
FILE: coding_interviews/leetcode/medium/minimum-add-to-make-parentheses-valid/minimum-add-to-make-parentheses-valid.js
function minAddToMakeValid (line 13) | function minAddToMakeValid(s) {
FILE: coding_interviews/leetcode/medium/minimum-amount-of-time-to-collect-garbage/minimum-amount-of-time-to-collect-garbage.js
function measure (line 1) | function measure(garbage, travel, garbageType) {
function garbageCollection (line 25) | function garbageCollection(garbage, travel) {
FILE: coding_interviews/leetcode/medium/minimum-cost-of-buying-candies-with-discount/minimum-cost-of-buying-candies-with-discount.js
function sum (line 3) | function sum(cost) {
function minimumCost (line 13) | function minimumCost(cost) {
FILE: coding_interviews/leetcode/medium/minimum-number-of-steps-to-make-two-strings-anagram/minimum-number-of-steps-to-make-two-strings-anagram.js
function buildMap (line 1) | function buildMap(string) {
function minSteps (line 12) | function minSteps(s, t) {
FILE: coding_interviews/leetcode/medium/minimum_number_of_operations_to_move_all_balls_to_each_box/minimum_number_of_operations_to_move_all_balls_to_each_box.py
function min_operations (line 3) | def min_operations(boxes):
function sum_moves (line 16) | def sum_moves(answer, boxes, boxes_indices):
function min_operations (line 29) | def min_operations(boxes):
FILE: coding_interviews/leetcode/medium/number-of-closed-islands/number-of-closed-islands.js
function generateVisitedKey (line 10) | function generateVisitedKey(row, col) {
function isInsideTheGrid (line 14) | function isInsideTheGrid(grid, row, col) {
function dfs (line 18) | function dfs(grid, row, col, visited) {
function closedIsland (line 41) | function closedIsland(grid) {
FILE: coding_interviews/leetcode/medium/number-of-enclaves/number-of-enclaves.js
function getVisitedKey (line 6) | function getVisitedKey(row, col) {
function isOffTheGrid (line 10) | function isOffTheGrid(grid, row, col) {
function dfs (line 14) | function dfs(grid, row, col, visited) {
function numEnclaves (line 41) | function numEnclaves(grid) {
FILE: coding_interviews/leetcode/medium/number-of-islands/number-of-islands.js
function isInsideTheGrid (line 1) | function isInsideTheGrid(grid, row, col) {
function dfs (line 5) | function dfs(grid, row, col) {
function numIslands (line 15) | function numIslands(grid) {
FILE: coding_interviews/leetcode/medium/number-of-laser-beams-in-a-bank/number-of-laser-beams-in-a-bank.js
function numberOfBeams (line 13) | function numberOfBeams(bank) {
FILE: coding_interviews/leetcode/medium/optimal-partition-of-string/optimal-partition-of-string.js
function partitionString (line 3) | function partitionString(s) {
FILE: coding_interviews/leetcode/medium/optimal-partition-of-string/optimized-optimal-partition-of-string.js
function partitionString (line 3) | function partitionString(s) {
FILE: coding_interviews/leetcode/medium/pair-sum/pair-sum.js
function pairSum (line 19) | function pairSum(list) {
function pairSumLinkedList (line 29) | function pairSumLinkedList(head) {
FILE: coding_interviews/leetcode/medium/partition-array-according-to-given-pivot/partition-array-according-to-given-pivot.js
function pivotArray (line 12) | function pivotArray(nums, pivot) {
FILE: coding_interviews/leetcode/medium/permutation-in-string/permutation-in-string-sliding-window.js
function buildCharCount (line 1) | function buildCharCount(string) {
function isPermutation (line 15) | function isPermutation(possiblePermutation, string) {
function checkInclusion (line 29) | function checkInclusion(s1, s2) {
FILE: coding_interviews/leetcode/medium/permutation-in-string/permutation-in-string.js
function buildCharCount (line 1) | function buildCharCount(string) {
function isPermutation (line 15) | function isPermutation(possiblePermutation, string) {
function checkInclusion (line 29) | function checkInclusion(s1, s2) {
FILE: coding_interviews/leetcode/medium/populating-next-right-pointers-in-each-node/populating-next-right-pointers-in-each-node-simpler.js
function dfs (line 1) | function dfs(node, next) {
function connect (line 10) | function connect(root) {
FILE: coding_interviews/leetcode/medium/populating-next-right-pointers-in-each-node/populating-next-right-pointers-in-each-node.js
function connectHelperRight (line 1) | function connectHelperRight(node) {
function connectHelper (line 10) | function connectHelper(node, next) {
function connect (line 21) | function connect(root) {
FILE: coding_interviews/leetcode/medium/process_queries/process_queries.py
function process_queries (line 1) | def process_queries(queries, m):
FILE: coding_interviews/leetcode/medium/product-of-array-except-self/product-of-array-except-self.js
function productExceptSelf (line 1) | function productExceptSelf(nums) {
FILE: coding_interviews/leetcode/medium/rearrange-array-elements-by-sign/rearrange-array-elements-by-sign.js
function isPositive (line 27) | function isPositive(num) {
function rearrangeArray (line 31) | function rearrangeArray(nums) {
FILE: coding_interviews/leetcode/medium/reduce_array_size_to_the_half/reduce_array_size_to_the_half.py
function min_set_size (line 8) | def min_set_size(arr):
FILE: coding_interviews/leetcode/medium/remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list-fast-slow.js
function removeNthFromEnd (line 1) | function removeNthFromEnd(head, n) {
FILE: coding_interviews/leetcode/medium/remove-nth-node-from-end-of-list/remove-nth-node-from-end-of-list.js
function countNodes (line 8) | function countNodes(head) {
function removeNthFromEnd (line 19) | function removeNthFromEnd(head, n) {
FILE: coding_interviews/leetcode/medium/rotate-array/rotate-array-optimized.js
function reverseInPlace (line 1) | function reverseInPlace(nums, start, end) {
function rotate (line 11) | function rotate(nums, k) {
FILE: coding_interviews/leetcode/medium/rotate-array/rotate-array.js
function rotate (line 1) | function rotate(nums, k) {
FILE: coding_interviews/leetcode/medium/rotate-image/rotate-image.js
function setupMatrix (line 1) | function setupMatrix(matrix) {
function rotateBorder (line 17) | function rotateBorder(newMatrix, matrix, minRow, minCol, maxRow, maxCol) {
function rotate (line 68) | function rotate(matrix) {
FILE: coding_interviews/leetcode/medium/search-a-2d-matrix-ii/search-a-2d-matrix-ii.py
function search_matrix (line 8) | def search_matrix(matrix, target):
function target_in_row (line 15) | def target_in_row(array, target):
FILE: coding_interviews/leetcode/medium/search-a-2d-matrix/search-a-2d-matrix.js
function getMiddle (line 1) | function getMiddle(start, end) {
function binarySearch (line 5) | function binarySearch(list, target) {
function searchMatrix (line 25) | function searchMatrix(matrix, target) {
FILE: coding_interviews/leetcode/medium/search-a-2d-matrix/search-a-2d-matrix.py
function search_matrix (line 8) | def search_matrix(matrix, target):
FILE: coding_interviews/leetcode/medium/set-matrix-zeroes/set-matrix-zeroes.js
function updateRow (line 1) | function updateRow(matrix, row, visited) {
function updateCol (line 10) | function updateCol(matrix, col, visited) {
function setZeroes (line 19) | function setZeroes(matrix) {
FILE: coding_interviews/leetcode/medium/sort-the-students-by-their-kth-score/sort-the-students-by-their-kth-score.js
function sortTheStudents (line 1) | function sortTheStudents(score, k) {
FILE: coding_interviews/leetcode/medium/sort_the_matrix_diagonally/sort_the_matrix_diagonally.py
function diagonal_sort (line 1) | def diagonal_sort(mat):
FILE: coding_interviews/leetcode/medium/string-compression/string-compression-copy.js
function compress (line 3) | function compress(chars) {
FILE: coding_interviews/leetcode/medium/string-compression/string-compression.js
function compress (line 3) | function compress(chars) {
FILE: coding_interviews/leetcode/medium/subrectangle_queries/subrectangle_queries.py
class SubrectangleQueries (line 4) | class SubrectangleQueries:
method __init__ (line 5) | def __init__(self, rectangle):
method updateSubrectangle (line 8) | def updateSubrectangle(self, row1, col1, row2, col2, newValue):
method getValue (line 13) | def getValue(self, row, col):
FILE: coding_interviews/leetcode/medium/sum_of_nodes/sum_of_nodes.py
function sum_even_grandparent (line 11) | def sum_even_grandparent(node):
function sum_even_grandparent_2 (line 36) | def sum_even_grandparent_2(node):
function helper (line 40) | def helper(node, parent, grandparent):
FILE: coding_interviews/leetcode/medium/two-sum-ii-input-array-is-sorted/two-sum-ii-input-array-is-sorted-2.js
function twoSum (line 1) | function twoSum(numbers, target) {
FILE: coding_interviews/leetcode/medium/two-sum-ii-input-array-is-sorted/two-sum-ii-input-array-is-sorted.js
function twoSum (line 1) | function twoSum(numbers, target) {
FILE: coding_interviews/leetcode/medium/valid-sudoku/valid-sudoku.js
function isValidRow (line 1) | function isValidRow(board, row) {
function isValidCol (line 17) | function isValidCol(board, col) {
function isValidSquare (line 33) | function isValidSquare(board, row, col) {
function isValidSudoku (line 51) | function isValidSudoku(board) {
FILE: coding_interviews/leetcode/medium/validate-binary-search-tree/validate-binary-search-tree-2.js
function isValidBST (line 1) | function isValidBST(node, min = -Infinity, max = Infinity) {
FILE: coding_interviews/leetcode/medium/validate-binary-search-tree/validate-binary-search-tree-almost-right.js
function isValidLeft (line 1) | function isValidLeft(node, left) {
function isValidRight (line 5) | function isValidRight(node, right) {
function isValid (line 9) | function isValid(node, left, right) {
function compareNodeAndChildren (line 13) | function compareNodeAndChildren(node, left, right) {
function isValidBST (line 39) | function isValidBST(root) {
FILE: coding_interviews/leetcode/medium/validate-binary-search-tree/validate-binary-search-tree.js
function toList (line 1) | function toList(node, treeList) {
function dfs (line 12) | function dfs(node, value) {
function buildTree (line 26) | function buildTree(treeList) {
function compareTrees (line 36) | function compareTrees(node1, node2) {
function isValidBST (line 52) | function isValidBST(root) {
FILE: coding_interviews/leetcode/medium/watering-plants/watering-plants.js
function wateringPlants (line 30) | function wateringPlants(plants, capacity) {
FILE: coding_interviews/top-problems/are-anagrams.js
function hasDifferentLengths (line 5) | function hasDifferentLengths(string1, string2) {
function buildCharsCount (line 9) | function buildCharsCount(string) {
function areAnagrams (line 23) | function areAnagrams(string1, string2) {
FILE: coding_interviews/top-problems/first-and-last-index.js
function firstAndLastIndex (line 10) | function firstAndLastIndex(list, target) {
function getMiddle (line 34) | function getMiddle(start, end) {
function findIndex (line 38) | function findIndex(list, target, type) {
function findFirstIndex (line 73) | function findFirstIndex(list, target) {
function findLastIndex (line 77) | function findLastIndex(list, target) {
function firstAndLastIndexBinarySearch (line 81) | function firstAndLastIndexBinarySearch(list, target) {
FILE: coding_interviews/top-problems/kth-largest.js
function kthLargest (line 5) | function kthLargest(list, k) {
FILE: coding_interviews/top-problems/min-sliding-window.js
function buildCharsCounter (line 1) | function buildCharsCounter(s) {
function compare (line 15) | function compare(s1, s2) {
function minSlidingWindow (line 28) | function minSlidingWindow(s, t) {
FILE: college/graph/atoms.py
function plot_graph (line 4) | def plot_graph(graph, pos, title):
FILE: competitive-programming/acm-icpc-br/regionals_2011/armstrong.cpp
function main (line 9) | int main()
FILE: competitive-programming/acm-icpc-br/regionals_2011/calculadora.cpp
function main (line 6) | int main()
FILE: competitive-programming/acm-icpc-br/regionals_2011/cartoes.cpp
function is_alberto_turn (line 6) | int is_alberto_turn(int counter) {
function main (line 13) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2011/concurso.cpp
function main (line 7) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2011/coral.cpp
function is_integer (line 9) | bool is_integer(float k) {
function all_equal (line 13) | bool all_equal(vector<int> &vetorzin) {
function main (line 19) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2011/elevador.cpp
function has_four (line 9) | bool has_four(string number) {
function has_thirteen (line 17) | bool has_thirteen(string number) {
function main (line 25) | int main () {
FILE: competitive-programming/acm-icpc-br/regionals_2011/estacionamento.cpp
function main (line 6) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2011/extenso.cpp
function split (line 13) | void split(string &n1, string &n2, string number) {
function string (line 19) | string transformNumberToCents(string cents) {
function string (line 46) | string transformNumberToReal(string reais) {
function main (line 113) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2011/goldbach.cpp
function verifica_primo (line 7) | int verifica_primo(int n) {
function main (line 29) | int main()
FILE: competitive-programming/acm-icpc-br/regionals_2011/matriz_esparsa.cpp
function main (line 5) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2011/pascal.cpp
function triangulo_pascal (line 5) | int triangulo_pascal(int n, int m) {
function main (line 13) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2011/polinomio.cpp
function solvePartEquation (line 9) | int solvePartEquation(string part_equation, int value) {
function main (line 21) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2011/quadrado.cpp
function main (line 7) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2011/vagas.cpp
function main (line 5) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2017_1/A.cpp
function build_segtree (line 10) | void build_segtree(int A[], int node, int start, int end) {
function propagate (line 20) | void propagate(int p, int start, int end) {
function lazy_update (line 33) | void lazy_update(int p, int start, int end, int left, int right, int inc) {
function lazy_query (line 55) | int lazy_query(int p, int start, int end, int left, int right) {
function print_all_leaves (line 67) | void print_all_leaves(int p, int start, int end) {
function main (line 77) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2017_2/D.cpp
function is_prime (line 5) | bool is_prime(int N) {
function main (line 9) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2017_2/F.cpp
function main (line 7) | int main() {
FILE: competitive-programming/acm-icpc-br/regionals_2017_2/M.cpp
function main (line 5) | int main() {
FILE: competitive-programming/codeforces/div2/black_square.cpp
function main (line 9) | int main() {
FILE: competitive-programming/codeforces/div2/karen_and_morning.cpp
function to_digit (line 8) | int to_digit(char c) {
function main (line 12) | int main() {
FILE: competitive-programming/codeforces/div2/keyboard_layouts.cpp
function is_uppercase (line 8) | bool is_uppercase(char word) {
function build_new_word (line 13) | char build_new_word(char letter, string alpha1, string alpha2) {
function main (line 28) | int main() {
FILE: competitive-programming/codeforces/div2/the_child_and_the_homework.cpp
function string (line 7) | string solve(string a, string b, string c, string d) {
function main (line 26) | int main() {
FILE: competitive-programming/codeforces/div2/the_child_and_toy.cpp
function min (line 7) | int min(int x, int y, int values[]) {
function main (line 11) | int main() {
FILE: competitive-programming/codeforces/div2/valera_and_plates.cpp
function main (line 7) | int main() {
FILE: competitive-programming/exercism/javascript/allergies.js
class Allergies (line 1) | class Allergies {
method constructor (line 2) | constructor(score) {
method list (line 17) | list() {
method findMaxSmallerThanScore (line 23) | findMaxSmallerThanScore(score) {
method allergicTo (line 35) | allergicTo(food) {
FILE: competitive-programming/exercism/javascript/count-words.js
constant SPECIAL_CHARACTERS (line 1) | const SPECIAL_CHARACTERS = /[!@#\$%\^\&*\".,;:?<>~`(\){}[\]\\/\+=_-]/g;
constant SPACE_CHARACTERS (line 2) | const SPACE_CHARACTERS = /\s+/g;
function isEmptySpace (line 4) | function isEmptySpace(string) {
function removeOpenQuote (line 8) | function removeOpenQuote(word) {
function removeCloseQuote (line 12) | function removeCloseQuote(word) {
function removeQuotes (line 16) | function removeQuotes(word) {
FILE: competitive-programming/exercism/javascript/resistor-color.js
constant COLORS (line 3) | const COLORS = [
FILE: competitive-programming/exercism/javascript/resistor-colors.js
constant COLORS (line 3) | const COLORS = [
FILE: competitive-programming/exercism/javascript/sublist.js
constant COMPARISON (line 1) | const COMPARISON = {
class List (line 8) | class List {
method constructor (line 9) | constructor(numbers = []) {
method compare (line 13) | compare(otherList) {
method isIdentical (line 35) | isIdentical(numbers, otherList) {
method isSublist (line 45) | isSublist(otherNumbers) {
method isSuperList (line 60) | isSuperList(numbers, otherNumbers) {
FILE: competitive-programming/exercism/javascript/triangle.js
function Triangle (line 1) | function Triangle(side1, side2, side3) {
FILE: competitive-programming/hacker-rank/algorithms/strings/palindrome_index.py
function is_palindrome (line 5) | def is_palindrome(s):
function palindrome_index (line 8) | def palindrome_index(s):
FILE: competitive-programming/hacker-rank/algorithms/warmup/birthday_cake_candles.py
function birthday_cake_candles (line 3) | def birthday_cake_candles(n, ar):
FILE: competitive-programming/hacker-rank/algorithms/warmup/mini_max_sum.py
function mini_max_sum (line 1) | def mini_max_sum(arr):
FILE: competitive-programming/hacker-rank/cpp/introduction/angry_professor.cpp
function main (line 5) | int main() {
FILE: competitive-programming/hacker-rank/cpp/introduction/arrays_introduction.cpp
function main (line 8) | int main() {
FILE: competitive-programming/hacker-rank/cpp/introduction/diagonal_difference.cpp
function main (line 6) | int main() {
FILE: competitive-programming/hacker-rank/cpp/introduction/input_and_output.cpp
function main (line 10) | int main() {
FILE: competitive-programming/hacker-rank/cpp/introduction/library_fine.cpp
function main (line 5) | int main() {
FILE: competitive-programming/hacker-rank/cpp/introduction/plus_minus.cpp
function main (line 5) | int main() {
FILE: competitive-programming/hacker-rank/cpp/introduction/staircase.cpp
function main (line 6) | int main() {
FILE: competitive-programming/hacker-rank/cpp/introduction/time_conversion.cpp
function main (line 6) | int main() {
FILE: competitive-programming/hacker-rank/cpp/introduction/vector_erase.cpp
function main (line 6) | int main() {
FILE: competitive-programming/hacker-rank/cpp/introduction/vector_sort.cpp
function main (line 7) | int main() {
FILE: competitive-programming/hacker-rank/data_structures/trees/in_order_traversal.py
function in_order (line 1) | def in_order(node):
FILE: competitive-programming/hacker-rank/data_structures/trees/post_order_traversal.py
function post_order (line 1) | def post_order(node):
FILE: competitive-programming/hacker-rank/data_structures/trees/pre_order_traversal.py
function pre_order (line 1) | def pre_order(node):
FILE: competitive-programming/hacker-rank/python/sets/intro_to_sets.py
function average (line 3) | def average(array):
FILE: competitive-programming/hacker-rank/python/strings/find_a_string.py
function count_substring (line 15) | def count_substring(string, sub_string):
FILE: competitive-programming/hacker-rank/python/strings/mutate_string.py
function mutate_string (line 7) | def mutate_string(string, position, character):
FILE: competitive-programming/hacker-rank/python/strings/split_and_join.py
function split_and_join (line 7) | def split_and_join(line):
FILE: competitive-programming/hacker-rank/python/strings/swap_case.py
function swap_case (line 6) | def swap_case(s):
FILE: competitive-programming/hacker-rank/python/strings/text_wrap.py
function wrap (line 5) | def wrap(string, max_width):
FILE: competitive-programming/hacker-rank/python/strings/whats_your_name.py
function print_full_name (line 7) | def print_full_name(a, b):
FILE: competitive-programming/interfatecs/1_2016/a.cpp
function main (line 7) | int main() {
FILE: competitive-programming/interfatecs/1_2016/b.cpp
function main (line 7) | int main() {
FILE: competitive-programming/interfatecs/1_2016/g.cpp
function main (line 9) | int main() {
FILE: competitive-programming/interfatecs/1_2016/i.cpp
function main (line 6) | int main() {
FILE: competitive-programming/interfatecs/1_2018/a.cpp
type debugger (line 26) | struct debugger
method debugger (line 28) | debugger& operator , (const T& v)
function maior (line 38) | bool maior(const pair<int, int> &a, const pair<int, int> &b) {
function main (line 47) | int main(void) {
FILE: competitive-programming/interfatecs/1_2018/b.cpp
type debugger (line 22) | struct debugger
method debugger (line 24) | debugger& operator , (const T& v)
function main (line 34) | int main(void) {
FILE: competitive-programming/interfatecs/1_2018/c.cpp
type debugger (line 22) | struct debugger
method debugger (line 24) | debugger& operator , (const T& v)
function main (line 34) | int main(void) {
FILE: competitive-programming/interfatecs/1_2018/d.py
function direction (line 20) | def direction(letter):
function letra_correta (line 30) | def letra_correta(i, j, pc):
function procura (line 34) | def procura(visitados, i, j, palavra, sequencia):
FILE: competitive-programming/interfatecs/1_2018/g.cpp
type debugger (line 22) | struct debugger
method debugger (line 24) | debugger& operator , (const T& v)
function main (line 34) | int main(void) {
FILE: competitive-programming/interfatecs/1_2018/h.cpp
type debugger (line 23) | struct debugger
method debugger (line 25) | debugger& operator , (const T& v)
function main (line 40) | int main(void) {
FILE: competitive-programming/interfatecs/1_2018/i.py
function data (line 9) | def data(data_string):
function analisar_boleto (line 16) | def analisar_boleto(boleto):
FILE: competitive-programming/interfatecs/1_2018/j.cpp
type debugger (line 25) | struct debugger
method debugger (line 27) | debugger& operator , (const T& v)
function preenche (line 42) | void preenche(int y, int x) {
function main (line 55) | int main(void) {
FILE: competitive-programming/spoj-br/aero.cpp
function main (line 8) | int main() {
FILE: competitive-programming/spoj-br/bafo.cpp
function main (line 7) | int main() {
FILE: competitive-programming/spoj-br/bapostas.cpp
function main (line 5) | int main() {
FILE: competitive-programming/spoj-br/bit.cpp
function main (line 9) | int main() {
FILE: competitive-programming/spoj-br/calcula.cpp
function main (line 5) | int main() {
FILE: competitive-programming/spoj-br/calculadora.cpp
function main (line 7) | int main() {
FILE: competitive-programming/spoj-br/dentista.cpp
function main (line 7) | int main() {
FILE: competitive-programming/spoj-br/desculpa.cpp
function max (line 6) | int max(int a, int b) {
function knapsack (line 10) | int knapsack(int W, int wt[], int val[], int n) {
function main (line 25) | int main() {
FILE: competitive-programming/spoj-br/eleicoes1.cpp
function main (line 8) | int main() {
FILE: competitive-programming/spoj-br/eleicoes2.cpp
function main (line 7) | int main() {
FILE: competitive-programming/spoj-br/estagio.cpp
function main (line 9) | int main() {
FILE: competitive-programming/spoj-br/fatorial.cpp
function custom_factorial (line 7) | int custom_factorial(int n) {
function main (line 34) | int main() {
FILE: competitive-programming/spoj-br/feyman.cpp
function quad (line 6) | int quad(int n) {
function main (line 14) | int main() {
FILE: competitive-programming/spoj-br/fliperam.cpp
function main (line 7) | int main() {
FILE: competitive-programming/spoj-br/gangorra.cpp
function main (line 6) | int main() {
FILE: competitive-programming/spoj-br/guardacosta.cpp
function main (line 7) | int main() {
FILE: competitive-programming/spoj-br/impedido.cpp
function main (line 6) | int main() {
FILE: competitive-programming/spoj-br/letra.cpp
function main (line 12) | int main() {
FILE: competitive-programming/spoj-br/loopmusi.cpp
function main (line 6) | int main() {
FILE: competitive-programming/spoj-br/lua.cpp
function main (line 9) | int main() {
FILE: competitive-programming/spoj-br/macaco.cpp
function main (line 7) | int main() {
FILE: competitive-programming/spoj-br/minhoca.cpp
function main (line 9) | int main() {
FILE: competitive-programming/spoj-br/miojo.cpp
function main (line 9) | int main() {
FILE: competitive-programming/spoj-br/obi.cpp
function main (line 6) | int main() {
FILE: competitive-programming/spoj-br/obihanoi.cpp
function main (line 10) | int main() {
FILE: competitive-programming/spoj-br/parprox.cpp
function main (line 11) | int main() {
FILE: competitive-programming/spoj-br/peca.cpp
function main (line 10) | int main() {
FILE: competitive-programming/spoj-br/primo.cpp
function is_prime (line 8) | long long int is_prime(int num) {
function main (line 26) | int main() {
FILE: competitive-programming/spoj-br/rumo9s.cpp
function main (line 5) | int main() {
FILE: competitive-programming/spoj-br/saldo.cpp
function main (line 6) | int main() {
FILE: competitive-programming/spoj-br/saldo13.cpp
function main (line 6) | int main() {
FILE: competitive-programming/spoj-br/sorvete.cpp
function main (line 7) | int main() {
FILE: competitive-programming/spoj-br/sudoku.cpp
function string (line 9) | string correct_sudoku(vector< vector<int> > matrix) {
function main (line 34) | int main() {
FILE: competitive-programming/spoj-br/telefone.cpp
function main (line 7) | int main() {
FILE: competitive-programming/spoj-br/transporte.cpp
function main (line 6) | int main() {
FILE: competitive-programming/spoj-br/troco13.cpp
function main (line 9) | int main() {
FILE: competitive-programming/spoj-br/vivo.cpp
function main (line 6) | int main() {
FILE: competitive-programming/spoj-br/wcw.cpp
function merge (line 6) | vector<int> merge(vector<int>& vec, const vector<int>& left, const vecto...
function merge_sort (line 35) | vector<int> merge_sort(vector<int>& vec) {
function main (line 51) | int main() {
FILE: competitive-programming/timus/a+b_problem.cpp
function main (line 7) | int main() {
FILE: competitive-programming/ucoder/armstrong_numbers.cpp
function main (line 9) | int main()
FILE: competitive-programming/ucoder/historico_de_comandos.cpp
function main (line 6) | int main() {
FILE: competitive-programming/ucoder/imperador_cassius.cpp
function main (line 4) | int main() {
FILE: competitive-programming/ucoder/matriz_esparsa.cpp
function main (line 5) | int main() {
FILE: competitive-programming/ucoder/obi.cpp
function main (line 4) | int main() {
FILE: competitive-programming/ucoder/tsetse.cpp
function main (line 5) | int main() {
FILE: competitive-programming/uri/3d_virtual_museum.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/a_long_time_ago.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/above_average.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/above_secundary_diagonal.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/above_the_main_diagonal.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/abracadabra.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/advancing_letters.cpp
function main (line 4) | int main() {
FILE: competitive-programming/uri/age_in_day.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/ages.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/alarm_clock.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/alliteration.cpp
function split_by_space (line 9) | void split_by_space(vector<string> &words, string phrase) {
function main (line 26) | int main() {
FILE: competitive-programming/uri/andys_first_dictionary.cpp
function parseString (line 10) | vector<string> parseString(string word) {
function string (line 30) | string lowerCase(string word) {
function main (line 48) | int main() {
FILE: competitive-programming/uri/angry_ducks.cpp
function rad (line 9) | double rad(double angle) {
function main (line 13) | int main() {
FILE: competitive-programming/uri/animal.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/approximate_number_of_primes.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/area.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/area_of_circle.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/arranging_tasks.cpp
type task (line 9) | struct task {
function sortByTime (line 13) | bool sortByTime(task &ta1, task &ta2) {
function main (line 19) | int main() {
FILE: competitive-programming/uri/array_123.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/array_change_1.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/array_fill_1.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/array_fill_2.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/array_fill_3.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/array_fill_4.cpp
function is_full (line 8) | bool is_full(vector<int> &v) {
function main (line 13) | int main() {
FILE: competitive-programming/uri/array_hash.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/array_replacement_1.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/array_selection_1.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/as_abas_de_pericles.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/ascending_and_descending.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/assigning_teams.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/automated_checking_machine.cpp
function main (line 5) | int main() {
FILE: competitive-programming/uri/average_1.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/average_2.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/average_3.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/average_speed.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/back_to_high_school_physics.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/bacteria_1.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/banknotes.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/banknotes_and_coins.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/baskharas_formula.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/batmain.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/bazinga.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/below_the_main_diagonal.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/below_the_secundary_diagonal.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/bill.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/bingo.cpp
function isPossible (line 10) | bool isPossible(const set<int> s, int n) {
function main (line 23) | int main() {
FILE: competitive-programming/uri/bla.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/blobs.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/bloggo_shotcuts.cpp
function string (line 8) | string edit_italic(char charac, bool is_start) {
function string (line 13) | string edit_bold(char charac, bool is_start) {
function main (line 18) | int main() {
FILE: competitive-programming/uri/bob_conduit.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/bodybuilder.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/brazil_world_cup.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/brazilian_economy.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/brick_game.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/bubbles_and_bucket.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/bubbles_and_bucket_2.cpp
function countNumberOfSwaps (line 12) | bool countNumberOfSwaps(int n1, int n2) {
function main (line 17) | int main() {
FILE: competitive-programming/uri/building_houses.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/building_walls.cpp
function split (line 10) | vector<string> split(string s) {
function to_digit (line 26) | int to_digit(string height) {
function main (line 35) | int main() {
FILE: competitive-programming/uri/buttlerflies.cpp
function new_specie (line 8) | int new_specie(vector<int> &v, int n) {
function main (line 17) | int main() {
FILE: competitive-programming/uri/c_mais_ou_menos.cpp
function get_vitamine_c (line 8) | int get_vitamine_c(string fruit) {
function main (line 18) | int main() {
FILE: competitive-programming/uri/caeser_cipher.cpp
function string (line 8) | string shift(string str, int n) {
function main (line 22) | int main() {
FILE: competitive-programming/uri/cannon.cpp
type missile (line 9) | struct missile {
function compare (line 13) | bool compare(missile m1, missile m2) {
function max (line 19) | int max(int a, int b) {
function main (line 23) | int main() {
FILE: competitive-programming/uri/canteen_queue.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/cash_roial.cpp
function enemies_counter (line 9) | int enemies_counter(vector<string> &V, int cx, int cy, int N, int M) {
function main (line 24) | int main() {
FILE: competitive-programming/uri/chinese_whispers.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/chirrin_chirrion.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/chocolate_factory.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/christmas_decoration.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/christmas_olympic.cpp
type country (line 10) | struct country {
function compareByMedals (line 17) | bool compareByMedals(const country &c1, const country &c2) {
function main (line 30) | int main() {
FILE: competitive-programming/uri/christmas_trapeziums.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/christmas_tree.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/close_the_doors.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/coast_guard.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/coffee_machine.cpp
function main (line 5) | int main() {
FILE: competitive-programming/uri/colision.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/collectable_cards.cpp
function mcd (line 6) | int mcd(int n1, int n2) {
function main (line 11) | int main() {
FILE: competitive-programming/uri/colourful_flowers.cpp
function get_greater_radius (line 9) | double get_greater_radius(int a, int b, int c) {
function get_triangle_area (line 14) | double get_triangle_area(int l1, int l2, int l3) {
function get_smaller_circunference_radius (line 23) | double get_smaller_circunference_radius(double triangle_area, double tri...
function main (line 27) | int main() {
FILE: competitive-programming/uri/column_in_array.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/combiner.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/compare_substring.cpp
function searchSubstring (line 8) | int searchSubstring(string s) {
function main (line 14) | int main() {
FILE: competitive-programming/uri/complete_sequence.cpp
function find_letter (line 8) | bool find_letter(char c) {
function not_in_phrase (line 14) | bool not_in_phrase(char c, string phrase) {
function main (line 19) | int main() {
FILE: competitive-programming/uri/consumption.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/contando_ciclos.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/contest.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/contract_revision.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/converting_to_hexadecimal.cpp
function string (line 10) | string reverseString(string hex) {
function main (line 16) | int main() {
FILE: competitive-programming/uri/coordinates_of_a_point.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/correct_colourful_flower.cpp
function main (line 7) | int main(){
FILE: competitive-programming/uri/corrida.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/counting_crow.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/counting_sheeps.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/cutoff_rounder.cpp
function string (line 9) | string get_integer_part(string n) {
function string (line 15) | string get_decimal_part(string n) {
function to_int (line 21) | int to_int(string num) {
function to_double (line 31) | double to_double(string num) {
function is_num_decimal_greater_than_or_equal_to_cutoff_decimal (line 43) | bool is_num_decimal_greater_than_or_equal_to_cutoff_decimal(string num, ...
function has_period (line 61) | bool has_period(string n) {
function main (line 66) | int main() {
FILE: competitive-programming/uri/cutoff_rounder_2.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/dancing_sentence.cpp
function to_uppercase (line 8) | char to_uppercase(char charac) {
function to_lowercase (line 14) | char to_lowercase(char charac) {
function is_uppercase (line 20) | bool is_uppercase(char charac) {
function main (line 26) | int main() {
FILE: competitive-programming/uri/dangerous_dive.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/dating_online.cpp
function main (line 16) | int main() {
FILE: competitive-programming/uri/deciphering_the_encrypted_card.cpp
function string (line 8) | string to_lowercase(string a) {
function string (line 20) | string decipher(string phrase, string f, string s) {
function main (line 31) | int main() {
FILE: competitive-programming/uri/delaunay_triangulation.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/desafio_de_bino.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/detective_watson_1.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/detective_watson_2.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/diamonds_and_sand.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/diet_plan.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/difference.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/different_digits.cpp
function different_digits (line 8) | int different_digits(int n) {
function main (line 30) | int main() {
FILE: competitive-programming/uri/difn.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/dijkstra.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/discovering_password.cpp
type oil (line 11) | struct oil {
function string (line 16) | string intToString(int passwordPart) {
function compareOiliness (line 22) | bool compareOiliness(const oil &oil1, const oil &oil2) {
function main (line 27) | int main() {
FILE: competitive-programming/uri/distance.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/distance_between_two_points.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/dividers.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/dividing_x_by_y.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/diving.cpp
function main (line 11) | int main() {
FILE: competitive-programming/uri/division_of_nlogonia.cpp
function main (line 4) | int main() {
FILE: competitive-programming/uri/divisors_1.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/dracarys.cpp
function get_result1 (line 8) | unsigned long long int get_result1(int d1, int d2, int v1, int v2) {
function get_result2 (line 20) | unsigned long long int get_result2(int d1, int d2, int v1, int v2) {
function get_result3 (line 32) | unsigned long long int get_result3(int d1, int d2, int v1, int v2) {
function main (line 49) | int main() {
FILE: competitive-programming/uri/drought.cpp
type city (line 10) | struct city {
function compareCities (line 15) | bool compareCities(const city &a, const city &b) {
function groupByMediumComsumption (line 19) | vector<city> groupByMediumComsumption(vector<city> &cities) {
function main (line 41) | int main() {
FILE: competitive-programming/uri/easy_difference_dates.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/easy_fibonacci.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/easy_problem_from_rujia_liu_1.cpp
function getKthOccurrence (line 8) | int getKthOccurrence(vector<unsigned long long int> &ar, int k, unsigned...
function main (line 19) | int main() {
FILE: competitive-programming/uri/easy_problem_from_rujia_liu_2.cpp
function getKthOccurrence (line 9) | int getKthOccurrence(map< int, vector<int> > &hash, int k, int v) {
function main (line 20) | int main() {
FILE: competitive-programming/uri/eletrical_outlet.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/encryption.cpp
function get_index (line 8) | int get_index(char letter) {
function get_element (line 14) | int get_element(char index) {
function is_number (line 21) | int is_number(char letter) {
function string (line 27) | string shift_to_the_right(string old_string) {
function string (line 44) | string shift_to_the_left(string old_string) {
function string (line 61) | string reverse(string password) {
function main (line 67) | int main() {
FILE: competitive-programming/uri/engine_failure.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/erasing_and_winning.cpp
function main (line 7) | int main(){
FILE: competitive-programming/uri/estimating_the_mean.cpp
function maximum_subsequence_sum (line 6) | int maximum_subsequence_sum(vector<int> &v) {
function main (line 20) | int main() {
FILE: competitive-programming/uri/etiquetas_de_noel.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/even_and_odd.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/even_between_five_numbers.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/even_numbers.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/even_or_odd.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/even_square.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/event.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/event_time.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/exceeding_z.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/exchanging_cards.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/experiments.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/extremely_basic.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/face_2015_free_gift.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/factorial.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/factorial_again.cpp
function factorial (line 8) | long long int factorial(int n) {
function main (line 13) | int main() {
FILE: competitive-programming/uri/factorial_sum.cpp
function factorial (line 7) | unsigned long long int factorial(int n) {
function main (line 12) | int main() {
FILE: competitive-programming/uri/fake_tickets.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/fans_and_ballons.cpp
function get_left_fan (line 9) | int get_left_fan(vector< vector<int> > &matrix, int row, int column) {
function get_right_fan (line 16) | int get_right_fan(vector< vector<int> > &matrix, int row, int column) {
function is_it_safe_for_left (line 23) | int is_it_safe_for_left(vector< vector<int> > &matrix, int row, int colu...
function is_it_safe_for_right (line 31) | int is_it_safe_for_right(vector< vector<int> > &matrix, int row, int col...
function main (line 38) | int main() {
FILE: competitive-programming/uri/farm_robot.cpp
function main (line 5) | int main (void) {
FILE: competitive-programming/uri/fase.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/fast_fibonacci.cpp
function fibonacci (line 9) | long double fibonacci(int n) {
function main (line 13) | int main() {
FILE: competitive-programming/uri/fast_prime_number.cpp
function is_prime (line 8) | int is_prime(int n) {
function main (line 23) | int main() {
FILE: competitive-programming/uri/feedback.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/feyman.cpp
function feyman (line 7) | int feyman(int n) {
function main (line 12) | int main() {
FILE: competitive-programming/uri/fibonacci_again.cpp
function fast_fib (line 11) | void fast_fib(long long int n,long long int ans[]) {
function main (line 37) | int main() {
FILE: competitive-programming/uri/fibonacci_array.cpp
function fib (line 7) | long long int fib(int n) {
function main (line 27) | int main() {
FILE: competitive-programming/uri/fila_do_supermercado.cpp
function getIndexOfSmallerTimeSpent (line 7) | int getIndexOfSmallerTimeSpent(map<int, int> &m) {
function main (line 20) | int main() {
FILE: competitive-programming/uri/fire_flowers.cpp
function to_positive (line 8) | int to_positive(int number) {
function main (line 13) | int main() {
FILE: competitive-programming/uri/fit_or_dont_fit_1.cpp
function verify_number (line 9) | int verify_number(unsigned long long int n1, unsigned long long int n2) {
function main (line 23) | int main() {
FILE: competitive-programming/uri/fit_or_dont_fit_2.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/fixed_password.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/flavious_josephus_legend.cpp
function verify_last_value (line 8) | int verify_last_value(vector<int> &v) {
function can_be_counted (line 14) | int can_be_counted(vector<int> &v, int index, int n) {
function get_last_value_index (line 24) | int get_last_value_index(vector<int> &v) {
function main (line 28) | int main() {
FILE: competitive-programming/uri/flavious_josephus_legend2.cpp
function parse_index (line 8) | int parse_index(int index, int size) {
function main (line 13) | int main() {
FILE: competitive-programming/uri/flavious_josephus_legend3.cpp
function josephus (line 7) | int josephus(int n, int k) {
function main (line 12) | int main() {
FILE: competitive-programming/uri/flowers_flourish_from_france.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/football.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/frequent_asked_questions.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/friends_of_habey.cpp
function compareByName (line 11) | bool compareByName(string name1, string name2) {
function main (line 15) | int main() {
FILE: competitive-programming/uri/fuel_spent.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/functions.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/galopeira.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/game_of_the_greatness.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/general_exam.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/getline_fruits.cpp
function num_of_fruits (line 9) | int num_of_fruits(string fruits) {
function main (line 15) | int main() {
FILE: competitive-programming/uri/getline_one.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/getline_three_shoes.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/going_to_the_market.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/grains_in_a_chess_board.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/grenais.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/growing_sequences.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/guess_what.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/guilherme_and_his_kites.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/guru_da_sorte.cpp
function get_value_for (line 8) | int get_value_for(string name) {
function get_result (line 24) | int get_result(int N) {
function main (line 41) | int main() {
FILE: competitive-programming/uri/hailstone_sequences.cpp
function resolve (line 7) | int resolve(int h, int max) {
function main (line 17) | int main() {
FILE: competitive-programming/uri/hall_of_murderers.cpp
function find (line 10) | bool find(string murder, vector<string> &people_killed) {
function main (line 18) | int main() {
FILE: competitive-programming/uri/hall_of_murderers_2.cpp
type person (line 10) | struct person {
function findPerson (line 16) | int findPerson(vector<person> &people, string name) {
function compareByName (line 23) | bool compareByName(const person &a, const person &b) {
function main (line 27) | int main() {
FILE: competitive-programming/uri/hall_of_murderers_3.cpp
function main (line 11) | int main() {
FILE: competitive-programming/uri/hamekameka.cpp
function string (line 8) | string ka(int as) {
function main (line 14) | int main() {
FILE: competitive-programming/uri/handball.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/hardwood_species.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/hash_tables.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/hashmat_the_brave_warrior.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/hay_points.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/he_is_offside!.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/head_or_tails.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/height.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/hello_galaxy.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/help!.cpp
function problem_incorrected (line 8) | bool problem_incorrected(string problems, char problem) {
function problem_solved (line 13) | bool problem_solved(string problems, char problem) {
function incorrect_submission_counter (line 18) | int incorrect_submission_counter(string problems, char problem) {
function main (line 24) | int main() {
FILE: competitive-programming/uri/help_girafales.cpp
function get_index (line 9) | int get_index(vector< pair<string, string> > names, string name) {
function main (line 15) | int main() {
FILE: competitive-programming/uri/help_seu_madruga.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/help_seu_madruga_int.cpp
function get_bigger (line 9) | int get_bigger(vector<int> &v) {
function area_binary_search (line 15) | int area_binary_search(vector<int> &v, int area) {
function main (line 33) | int main() {
FILE: competitive-programming/uri/help_the_federation.cpp
type team (line 10) | struct team {
function compareTeams (line 18) | bool compareTeams(const team &team1, const team &team2) {
function main (line 31) | int main() {
FILE: competitive-programming/uri/hexagonal_tiles_1.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/hexagonal_tiles_2.cpp
function resolve (line 7) | int resolve(int n1, int n2) {
function main (line 13) | int main() {
FILE: competitive-programming/uri/hidden_message.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/highest_and_position.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/hohoho.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/honey_reservoir.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/hours_and_minutes.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/how_easy.cpp
function correct_word (line 9) | bool correct_word(string word) {
function parse_string (line 15) | vector<string> parse_string(string line) {
function main (line 39) | int main() {
FILE: competitive-programming/uri/huehue.cpp
function string (line 8) | string removeConsoants(string s) {
function funniest (line 21) | bool funniest(string s) {
function main (line 30) | int main() {
FILE: competitive-programming/uri/i_am_toorg.cpp
function main (line 5) | int main() {
FILE: competitive-programming/uri/ice_statuses.cpp
function min (line 9) | int min(int a, int b) {
function main (line 13) | int main() {
FILE: competitive-programming/uri/identifying_tea.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/image.cpp
function string (line 9) | string concatenate(char c, int times) {
function main (line 15) | int main() {
FILE: competitive-programming/uri/impar_par_roubo.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/inferior_area.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/inside_out.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/international_chat.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/internship.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/interval.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/interval2.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/inverse_numbers.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/is_triangle.cpp
function is_triangle (line 7) | int is_triangle(int a, int b, int c) {
function main (line 12) | int main() {
FILE: competitive-programming/uri/jetiqui.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/jingle_composing.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/jogatina_ufpa.cpp
function main (line 5) | int main() {
FILE: competitive-programming/uri/jollo.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/joulupukki.cpp
function split (line 9) | vector<string> split(string s) {
function string (line 28) | string transformWord(string word) {
function main (line 38) | int main() {
FILE: competitive-programming/uri/jumping_frog.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/just_in_time.cpp
function main (line 9) | int main (void) {
function isPrimo (line 19) | bool isPrimo(int n) {
function menorPrimo (line 33) | int menorPrimo(int n) {
FILE: competitive-programming/uri/justifier.cpp
function get_greater_size (line 9) | int get_greater_size(vector<string> &v) {
function string (line 15) | string concatenate_spaces(int n) {
function main (line 21) | int main() {
FILE: competitive-programming/uri/justifier_2.cpp
function get_greater_size (line 9) | int get_greater_size(vector<string> &v) {
function string (line 15) | string concatenate_spaces(int n) {
function string (line 21) | string remove_first_spaces(string phrase) {
function string (line 32) | string remove_spaces(string phrase) {
function main (line 48) | int main() {
FILE: competitive-programming/uri/kage_bunshin_no_jutsu.cpp
function jutsuNumber (line 5) | int jutsuNumber(long long int N) {
function main (line 10) | int main() {
FILE: competitive-programming/uri/kiloman.cpp
function is_hit (line 9) | bool is_hit(vector<int> &v, string js, int ind) {
function main (line 15) | int main() {
FILE: competitive-programming/uri/koch_snowflake.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/lap.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/laser_sculpture.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/last_analogimon.cpp
function main (line 5) | int main() {
FILE: competitive-programming/uri/laundry.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/leaders_impeachment.cpp
function main (line 5) | int main() {
FILE: competitive-programming/uri/led.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/left_area.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/libertadores_1.cpp
function parse_string (line 10) | vector<string> parse_string(string line) {
function to_digit (line 30) | int to_digit(char digit) {
function string_to_number (line 34) | int string_to_number(string n) {
type team (line 48) | struct team {
function main (line 54) | int main() {
FILE: competitive-programming/uri/libertadores_2.cpp
function main (line 6) | int main() {
FILE: competitive-programming/uri/line_in_array.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/linear_parking_lot.cpp
type car (line 8) | struct car {
function main (line 13) | int main() {
FILE: competitive-programming/uri/little_ant.cpp
function main (line 5) | int main() {
FILE: competitive-programming/uri/logical_sequence.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/logical_sequence_2.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/lost_boots.cpp
function main (line 10) | int main() {
FILE: competitive-programming/uri/lowest_number_and_position.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/lu_di_oh.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/lucro.cpp
function max (line 7) | int max(int a, int b) {
function main (line 11) | int main() {
FILE: competitive-programming/uri/lucro_otimizado.cpp
function max (line 7) | int max(int a, int b) {
function main (line 11) | int main() {
FILE: competitive-programming/uri/macpronalts.cpp
function total_price (line 8) | double total_price(int code, int number) {
function main (line 21) | int main() {
FILE: competitive-programming/uri/maesters_map.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/mean_median_problem.cpp
function is_integer (line 8) | int is_integer(double n) {
function main (line 13) | int main() {
FILE: competitive-programming/uri/medal_table.cpp
type country (line 10) | struct country {
function compareByMedals (line 17) | bool compareByMedals(const country &c1, const country &c2) {
function main (line 30) | int main() {
FILE: competitive-programming/uri/merry_christmaaaas.cpp
function string (line 8) | string happiness_index(int index) {
function main (line 14) | int main() {
FILE: competitive-programming/uri/mirror_sequence.cpp
function string (line 9) | string toString(int n) {
function string (line 15) | string reverseString(string s) {
function main (line 21) | int main() {
FILE: competitive-programming/uri/mjolnir.cpp
function main (line 8) | int main() {
FILE: competitive-programming/uri/monetary_formatting.cpp
function under_ten (line 8) | bool under_ten(string cents) {
function string (line 13) | string reverse_string(string s) {
function string (line 19) | string parse_string(string s, string cents) {
function main (line 42) | int main() {
FILE: competitive-programming/uri/montanha_russa.cpp
function main (line 5) | int main() {
FILE: competitive-programming/uri/month.cpp
function main (line 9) | int main() {
FILE: competitive-programming/uri/moon_phases.cpp
function main (line 7) | int main() {
FILE: competitive-programming/uri/morse.cpp
function createMorseTable (line 8) | void createMorseTable(map<string, string> &morse) {
function string (line 37) | string buildCode(string partial, in
Condensed preview — 1561 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,228K chars).
[
{
"path": ".github/workflows/push-ci.yml",
"chars": 456,
"preview": "name: Push CI\n\non: [push]\n\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v2\n "
},
{
"path": ".gitignore",
"chars": 246,
"preview": "*.pyc\n__pycache__\n.pytest_cache\n\n# dependencies\n/node_modules\n/.pnp\n.pnp.js\n\n# testing\n/coverage\n\n# production\n/build\n\n#"
},
{
"path": ".nvmrc",
"chars": 8,
"preview": "v20.4.0\n"
},
{
"path": ".prettierrc",
"chars": 69,
"preview": "{\n \"trailingComma\": \"es5\",\n \"tabWidth\": 2,\n \"singleQuote\": true\n}\n"
},
{
"path": ".vscode/settings.json",
"chars": 84,
"preview": "{\n \"[javascript]\": {\n \"editor.defaultFormatter\": \"esbenp.prettier-vscode\"\n }\n}\n"
},
{
"path": "FUNDING.yml",
"chars": 57,
"preview": "github: [imteekay]\ncustom: [https://teekay.substack.com]\n"
},
{
"path": "LICENSE",
"chars": 1054,
"preview": "MIT License\n\nCopyright (c) TK\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this soft"
},
{
"path": "README.md",
"chars": 16384,
"preview": "<samp>\n\n# Algorithms & Data Structures\n\n## Introduction\n\n- [🎥 Algorithms and Data Structures Tutorial](https://www.youtu"
},
{
"path": "big-o.md",
"chars": 1757,
"preview": "# Big O\n\n| Big O Notation | Type | Computations for 10 elements | Computations for 100 elements | Computations fo"
},
{
"path": "coding_interviews/README.md",
"chars": 6463,
"preview": "<samp>\n\n# Interview Traning\n\n## Tech Interview Preparation\n\n### Before the interview\n\n- Referral Is The Core\n - Talk to"
},
{
"path": "coding_interviews/algoexpert/README.md",
"chars": 13,
"preview": "# AlgoExpert\n"
},
{
"path": "coding_interviews/algoexpert/array-of-products/array-of-products-optimized.js",
"chars": 998,
"preview": "/**\n *\n * Write a function that takes in a non-empty array of integers and returns\n * an array of the same length, where"
},
{
"path": "coding_interviews/algoexpert/array-of-products/array-of-products.js",
"chars": 986,
"preview": "/**\n *\n * Write a function that takes in a non-empty array of integers and returns\n * an array of the same length, where"
},
{
"path": "coding_interviews/algoexpert/best-seat/best-seat.js",
"chars": 1844,
"preview": "/**\n * You walk into a theatre you're about to see a show in. The usher within\n * the theatre walks you to your row and "
},
{
"path": "coding_interviews/algoexpert/binary-search/binary-search.js",
"chars": 454,
"preview": "// Runtime: O(logN)\n// Space: O(1)\n\nfunction binarySearch(array, target) {\n let start = 0;\n let end = array.length - 1"
},
{
"path": "coding_interviews/algoexpert/branch-sums/branch-sums-without-recreating-sums.js",
"chars": 621,
"preview": "// Runtime: O(N), N = number of nodes\n// Space: list of branch sums (number of leaf nodes) is O(N) and recursive algorit"
},
{
"path": "coding_interviews/algoexpert/branch-sums/branch-sums.js",
"chars": 601,
"preview": "// Runtime: O(N), N = number of nodes\n// Space: list of branch sums (number of leaf nodes) is O(N) and recursive algorit"
},
{
"path": "coding_interviews/algoexpert/bst-construction/bst-construction.js",
"chars": 3269,
"preview": "/**\nBST Construction\n\nWrite a BST class for a Binary Search Tree. The class should support:\n\nInserting values with the i"
},
{
"path": "coding_interviews/algoexpert/bst-traversal/bst-traversal.js",
"chars": 551,
"preview": "function inOrderTraverse(tree, array) {\n if (!tree) return;\n inOrderTraverse(tree.left, array);\n array.push(tree.valu"
},
{
"path": "coding_interviews/algoexpert/bubble-sort/bubble-sort.js",
"chars": 398,
"preview": "// Runtime: O(N^2)\n// Space: O(1)\n\nfunction bubbleSort(array) {\n let sorted = false;\n\n while (!sorted) {\n sorted = "
},
{
"path": "coding_interviews/algoexpert/caesar-cipher-encryptor/caesar-cipher-encryptor.js",
"chars": 306,
"preview": "// Runtime: O(N), N = number of characters\n// Space: O(N)\n\nfunction getChar(char, key) {\n let charCode = ((char.charCod"
},
{
"path": "coding_interviews/algoexpert/class-photos/class-photos.js",
"chars": 504,
"preview": "function classPhotos(redShirtHeights, blueShirtHeights) {\n redShirtHeights.sort((a, b) => a - b);\n blueShirtHeights.so"
},
{
"path": "coding_interviews/algoexpert/common-characters/common-characters.js",
"chars": 915,
"preview": "// Runtime: (N * M), N = number of strings and M = length of biggest string\n// Space: (M), M = length of biggest string\n"
},
{
"path": "coding_interviews/algoexpert/depth-first-search/depth-first-search-cleaner.js",
"chars": 404,
"preview": "// Runtime: O(V + E), V = vertices, E = edges\n// Space: O(V), V = vertices\n\nclass Node {\n constructor(name) {\n this."
},
{
"path": "coding_interviews/algoexpert/depth-first-search/depth-first-search.js",
"chars": 504,
"preview": "// Runtime: O(V + E), V = vertices, E = edges\n// Space: O(V), V = vertices\n\nclass Node {\n constructor(name) {\n this."
},
{
"path": "coding_interviews/algoexpert/evaluate-expression-tree/evaluate-expression-tree-cleaner.js",
"chars": 441,
"preview": "function evaluateExpressionTree({value, left, right}) {\n if (value === -1) return evaluateExpressionTree(left) + evalua"
},
{
"path": "coding_interviews/algoexpert/evaluate-expression-tree/evaluate-expression-tree-with-trunc.js",
"chars": 467,
"preview": "function evaluateExpressionTree(tree) {\n if (!tree) return null;\n\n let leftValue = evaluateExpressionTree(tree.left);\n"
},
{
"path": "coding_interviews/algoexpert/evaluate-expression-tree/evaluate-expression-tree.js",
"chars": 529,
"preview": "function evaluateExpressionTree(tree) {\n if (!tree) return null;\n\n let leftValue = evaluateExpressionTree(tree.left);\n"
},
{
"path": "coding_interviews/algoexpert/find-closest-value-in-bst/find-closest-value-in-bst-optimized-cleaner.js",
"chars": 611,
"preview": "// Runtime\n// - average: O(logN), where N = number of nodes in the tree\n// - worst case: O(N), where N = number of nodes"
},
{
"path": "coding_interviews/algoexpert/find-closest-value-in-bst/find-closest-value-in-bst-optimized.js",
"chars": 1028,
"preview": "// Runtime\n// - average: O(logN), where N = number of nodes in the tree\n// - worst case: O(N), where N = number of nodes"
},
{
"path": "coding_interviews/algoexpert/find-closest-value-in-bst/find-closest-value-in-bst.js",
"chars": 807,
"preview": "// Runtime: O(N), where N = number of nodes in the tree\n// Space: O(1)\n\nfunction findClosestValueInBst(tree, target, clo"
},
{
"path": "coding_interviews/algoexpert/find-three-largest-numbers/find-three-largest-numbers.js",
"chars": 469,
"preview": "// Runtime: O(N), N = number of numbers in the array\n// Space: O(1)\n\nfunction findThreeLargestNumbers(array) {\n let fir"
},
{
"path": "coding_interviews/algoexpert/first-duplicate-value/first-duplicate-value-optimized.js",
"chars": 933,
"preview": "/**\n * Given an array of integers between 1 and n, inclusive, where n is the length of\n * the array, write a function th"
},
{
"path": "coding_interviews/algoexpert/first-duplicate-value/first-duplicate-value.js",
"chars": 856,
"preview": "/**\n * Given an array of integers between 1 and n, inclusive, where n is the length of\n * the array, write a function th"
},
{
"path": "coding_interviews/algoexpert/first-non-repeating-character/first-non-repeating-character.js",
"chars": 326,
"preview": "// Runtime: O(N), N = string length\n// Space: O(N)\n\nfunction firstNonRepeatingCharacter(string) {\n let map = new Map();"
},
{
"path": "coding_interviews/algoexpert/generate-document/generate-document.js",
"chars": 1321,
"preview": "/**\n *\n * You're given a string of available characters and a string representing a document that you need to generate.\n"
},
{
"path": "coding_interviews/algoexpert/insertion-sort/insertion-sort.js",
"chars": 425,
"preview": "// Runtime: O(N^2)\n// Space: O(1)\n\nfunction swap(array, i, j) {\n let aux = array[i];\n array[i] = array[j];\n array[j] "
},
{
"path": "coding_interviews/algoexpert/longest-peak/longest-peak.js",
"chars": 1543,
"preview": "/**\n * Write a function that takes in an array of integers and returns\n * the length of the longest peak in the array.\n "
},
{
"path": "coding_interviews/algoexpert/majority-element/majority-element.js",
"chars": 423,
"preview": "// Runtime: O(N^2)\n// Space: O(N)\n\nfunction majorityElement(array) {\n let half = Math.floor(array.length / 2);\n\n if (a"
},
{
"path": "coding_interviews/algoexpert/merge-overlapping-intervals/merge-overlapping-intervals.js",
"chars": 1313,
"preview": "/**\n * Write a function that takes in a non-empty array of arbitrary intervals,\n * merges any overlapping intervals, and"
},
{
"path": "coding_interviews/algoexpert/middle-node/middle-node-slow-fast.js",
"chars": 259,
"preview": "// Runtime: O(N), N = number of nodes in the linked list\n// Space: O(1)\n\nfunction middleNode(linkedList) {\n let fast = "
},
{
"path": "coding_interviews/algoexpert/middle-node/middle-node.js",
"chars": 396,
"preview": "// Runtime: O(N), N = number of nodes in the linked list\n// Space: O(1)\n\nfunction middleNode(linkedList) {\n let length "
},
{
"path": "coding_interviews/algoexpert/minimum-waiting-time/minimum-waiting-time.js",
"chars": 229,
"preview": "function minimumWaitingTime(queries) {\n let waitingTime = 0;\n let previous = 0;\n\n queries.sort((a, b) => a - b);\n\n f"
},
{
"path": "coding_interviews/algoexpert/missing-numbers/missing-numbers.js",
"chars": 339,
"preview": "// Runtime: O(N)\n// Space: O(N)\n\nfunction missingNumbers(nums) {\n let numbers = [];\n\n for (let index = 0; index < nums"
},
{
"path": "coding_interviews/algoexpert/monotonic-array/monotonic-array-optimization-1.js",
"chars": 1149,
"preview": "/**\n * Write a function that takes in an array of integers and returns a boolean\n * representing whether the array is mo"
},
{
"path": "coding_interviews/algoexpert/monotonic-array/monotonic-array-optimization-2.js",
"chars": 1023,
"preview": "/**\n * Write a function that takes in an array of integers and returns a boolean\n * representing whether the array is mo"
},
{
"path": "coding_interviews/algoexpert/monotonic-array/monotonic-array.js",
"chars": 1210,
"preview": "/**\n * Write a function that takes in an array of integers and returns a boolean\n * representing whether the array is mo"
},
{
"path": "coding_interviews/algoexpert/move-element-to-end/move-element-to-end.js",
"chars": 836,
"preview": "/**\n * You're given an array of integers and an integer. Write a function that\n * moves all instances of that integer in"
},
{
"path": "coding_interviews/algoexpert/node-depths/node-depths.js",
"chars": 221,
"preview": "// Runtime: O(N), N = number of nodes\n// Space: O(H), H = height of the tree\n\nfunction nodeDepths(root, sum = 0) {\n if "
},
{
"path": "coding_interviews/algoexpert/non-constructible-change/non-constructible-change.js",
"chars": 336,
"preview": "// Runtime: O(nlogn)\n// Space: O(1)\n\nfunction nonConstructibleChange(coins) {\n coins.sort((a, b) => a - b);\n\n let curr"
},
{
"path": "coding_interviews/algoexpert/nth-fibonacci/nth-fibonacci-memo-no-space.js",
"chars": 275,
"preview": "// Runtime: O(N)\n// Space: O(1)\n\nfunction getNthFib(n) {\n if (n === 1) return 0;\n if (n === 2) return 1;\n\n let first "
},
{
"path": "coding_interviews/algoexpert/nth-fibonacci/nth-fibonacci-memo.js",
"chars": 277,
"preview": "// Runtime: O(N)\n// Space: O(N)\n\nfunction getNthFib(n) {\n if (n === 1) return 0;\n if (n === 2) return 1;\n\n let memo ="
},
{
"path": "coding_interviews/algoexpert/nth-fibonacci/nth-fibonacci.js",
"chars": 182,
"preview": "// Runtime: O(2^N)\n// Space: O(N)\n\nfunction getNthFib(n) {\n if (n === 0) return 0;\n if (n === 1) return 0;\n if (n ==="
},
{
"path": "coding_interviews/algoexpert/optimal-freelancing/optimal-freelancing-sorting.js",
"chars": 568,
"preview": "function sortJobs(jobs) {\n jobs.sort((job1, job2) => {\n if (job1.payment > job2.payment) return -1;\n if (job1.pay"
},
{
"path": "coding_interviews/algoexpert/optimal-freelancing/optimal-freelancing.js",
"chars": 472,
"preview": "function optimalFreelancing(jobs) {\n let profit = 0;\n let day = 7;\n let completedJobs = new WeakSet();\n\n while (day "
},
{
"path": "coding_interviews/algoexpert/palindrome-check/palindrome-check.js",
"chars": 349,
"preview": "// Runtime: O(N), N = characters in the string\n// Space: O(1)\n\nfunction isPalindrome(string) {\n let start = 0;\n let en"
},
{
"path": "coding_interviews/algoexpert/product-sum/product-sum-timer-later.js",
"chars": 349,
"preview": "// Runtime: O(N), N = all numbers including the numbers inside nested arrays\n// Space: O(D), D = the depth of the nested"
},
{
"path": "coding_interviews/algoexpert/product-sum/product-sum.js",
"chars": 365,
"preview": "// Runtime: O(N), N = all numbers including the numbers inside nested arrays\n// Space: O(D), D = the depth of the nested"
},
{
"path": "coding_interviews/algoexpert/remove-duplicates-from-linked-list/remove-duplicates-from-linked-list.js",
"chars": 363,
"preview": "// Runtime: O(N), N = number of nodes in the linked list\n// Space: O(1)\n\nfunction removeDuplicatesFromLinkedList(linkedL"
},
{
"path": "coding_interviews/algoexpert/remove-islands/remove-islands-optimized.js",
"chars": 2513,
"preview": "/**\nYou're given a two-dimensional array (a matrix) of potentially unequal height and width containing only 0s and 1s.\nT"
},
{
"path": "coding_interviews/algoexpert/remove-islands/remove-islands.js",
"chars": 2383,
"preview": "/**\nYou're given a two-dimensional array (a matrix) of potentially unequal height and width containing only 0s and 1s.\nT"
},
{
"path": "coding_interviews/algoexpert/run-length-encoding/run-length-encoding copy.js",
"chars": 359,
"preview": "function runLengthEncoding(string) {\n let currentChar;\n let num = 1;\n let result = [];\n\n for (let index = 0; index <"
},
{
"path": "coding_interviews/algoexpert/run-length-encoding/run-length-encoding-cleaner.js",
"chars": 670,
"preview": "function runLengthEncoding(string) {\n if (string.length === 1) {\n return `1${string}`;\n }\n\n let currentChar = stri"
},
{
"path": "coding_interviews/algoexpert/run-length-encoding/run-length-encoding.js",
"chars": 670,
"preview": "function runLengthEncoding(string) {\n if (string.length === 1) {\n return `1${string}`;\n }\n\n let currentChar = stri"
},
{
"path": "coding_interviews/algoexpert/semordnilap/semordnilap.js",
"chars": 974,
"preview": "/**\nWrite a function that takes in a list of unique strings\nand returns a list of semordnilap pairs.\n\nA semordnilap pair"
},
{
"path": "coding_interviews/algoexpert/smallest-difference/smallest-difference.js",
"chars": 1393,
"preview": "/**\n *\n * Write a function that takes in two non-empty arrays of integers,\n * finds the pair of numbers (one from each a"
},
{
"path": "coding_interviews/algoexpert/sorted-squared-array/sorted-squared-array-insert-position.js",
"chars": 464,
"preview": "// Runtime: O(n)\n// Space: O(n)\n\nfunction sortedSquaredArray(array) {\n let output = [];\n\n for (let num of array) {\n "
},
{
"path": "coding_interviews/algoexpert/sorted-squared-array/sorted-squared-array-two-pointers.js",
"chars": 395,
"preview": "// Runtime: O(n)\n// Space: O(n)\n\nfunction sortedSquaredArray(array) {\n let p1 = 0;\n let p2 = array.length - 1;\n let r"
},
{
"path": "coding_interviews/algoexpert/sorted-squared-array/sorted-squared-array.js",
"chars": 138,
"preview": "// Runtime: O(nlogn)\n// Space: O(1)\n\nfunction sortedSquaredArray(array) {\n return array.map((num) => num * num).sort((a"
},
{
"path": "coding_interviews/algoexpert/spiral-traverse/spiral-traverse.js",
"chars": 1764,
"preview": "/**\n *\n * Write a function that takes in an n x m two-dimensional array (that can be square-shaped when n == m)\n * and r"
},
{
"path": "coding_interviews/algoexpert/tandem-bicycle/tandem-bicycle-cleaner.js",
"chars": 493,
"preview": "// Runtime: O(NlogN)\n// Space: O(1)\n\nfunction getTotalSpeed(redShirtSpeeds, blueShirtSpeeds) {\n let sum = 0;\n\n for (le"
},
{
"path": "coding_interviews/algoexpert/tandem-bicycle/tandem-bicycle.js",
"chars": 843,
"preview": "// Runtime: O(NlogN)\n// Space: O(1)\n\nfunction getMinimumTotalSpeed(redShirtSpeeds, blueShirtSpeeds) {\n let sum = 0;\n\n "
},
{
"path": "coding_interviews/algoexpert/three-number-sum/three-number-sum.js",
"chars": 1350,
"preview": "function sortKey(array) {\n return [...new Set(array)]\n .sort((a, b) => a - b)\n .map((num) => num.toString())\n "
},
{
"path": "coding_interviews/algoexpert/tournament-winner/tournament-winner-optimized.js",
"chars": 593,
"preview": "// Runtime: O(n), n being the number of competition\n// Space: O(k), k being the number of teams\n\nfunction tournamentWinn"
},
{
"path": "coding_interviews/algoexpert/tournament-winner/tournament-winner.js",
"chars": 620,
"preview": "// Runtime: O(n), n being the number of competition\n// Space: O(k), k being the number of teams\n\nfunction tournamentWinn"
},
{
"path": "coding_interviews/algoexpert/transpose-matrix/transpose-matrix.js",
"chars": 389,
"preview": "// Runtime: O(R * C), R = rows and C = columns\n// Space: O(N)\n\nfunction transposeMatrix(matrix) {\n let transposedMatrix"
},
{
"path": "coding_interviews/algoexpert/two-number-sum/two-number-sum-optimized.js",
"chars": 290,
"preview": "// Runtime: O(n)\n// Space: O(n)\n\nfunction twoNumberSum(array, targetSum) {\n let hashmap = new Map();\n\n for (let num of"
},
{
"path": "coding_interviews/algoexpert/two-number-sum/two-number-sum-two-pointers.js",
"chars": 469,
"preview": "// Runtime: O(nlogn)\n// Space: O(1)\n\nfunction twoNumberSum(array, targetSum) {\n array.sort((a, b) => a - b);\n\n let lef"
},
{
"path": "coding_interviews/algoexpert/two-number-sum/two-number-sum.js",
"chars": 324,
"preview": "// Runtime: O(n^2)\n// Space: O(1)\n\nfunction twoNumberSum(array, targetSum) {\n let hashmap = new Map();\n\n for (let num "
},
{
"path": "coding_interviews/algoexpert/validate-bst/validate-bst.js",
"chars": 548,
"preview": "class BST {\n constructor(value) {\n this.value = value;\n this.left = null;\n this.right = null;\n }\n}\n\nfunction "
},
{
"path": "coding_interviews/algoexpert/validate-subsequence/validate-subsequence-two-pointers.js",
"chars": 296,
"preview": "// Runtime: O(n)\n// Space: O(1)\n\nfunction isValidSubsequence(array, sequence) {\n let p1 = 0;\n let p2 = 0;\n\n while (p1"
},
{
"path": "coding_interviews/algoexpert/validate-subsequence/validate-subsequence.js",
"chars": 288,
"preview": "// Runtime: O(n)\n// Space: O(1)\n\nfunction isValidSubsequence(array, sequence) {\n let p = 0;\n\n for (let index = 0; inde"
},
{
"path": "coding_interviews/algoexpert/zero-sum-subarray/zero-sum-subarray-optimized.js",
"chars": 343,
"preview": "// Runtime: O(N), N = nums length\n// Space: O(N)\n\nfunction zeroSumSubarray(nums) {\n let currentSum = 0;\n let sums = ne"
},
{
"path": "coding_interviews/algoexpert/zero-sum-subarray/zero-sum-subarray.js",
"chars": 330,
"preview": "// Runtime: O(N^2), N = nums length\n// Space: O(1)\n\nfunction zeroSumSubarray(nums) {\n for (let i = 0; i < nums.length; "
},
{
"path": "coding_interviews/algorithms_in_python/queue/R-6.7.py",
"chars": 1468,
"preview": "# What values are returned during the following sequence of queue operations,\n# if executed on an initially empty queue?"
},
{
"path": "coding_interviews/algorithms_in_python/stack/R-6.1.py",
"chars": 1349,
"preview": "# R-6.1 from the Algorithms in Pytho book\n# What values are returned during the following series of stack operations,\n# "
},
{
"path": "coding_interviews/algorithms_in_python/stack/R-6.3.py",
"chars": 1090,
"preview": "# R-6.3 from the Algorithms in Pytho book\n# Implement a function with signature transfer(S, T) that transfers all elemen"
},
{
"path": "coding_interviews/algorithms_in_python/stack/R-6.4.py",
"chars": 908,
"preview": "# R-6.4 from the Algorithms in Pytho book\n# Give a recursive method for removing all the elements from a stack.\n\n\nclass "
},
{
"path": "coding_interviews/algorithms_in_python/stack/R-6.5.py",
"chars": 1035,
"preview": "# R-6.5 from the Algorithms in Pytho book\n# Implement a function that reverses a list of elements by pushing them onto\n#"
},
{
"path": "coding_interviews/blind75/README.md",
"chars": 9183,
"preview": "<samp>\n\n# Blind 75 LeetCode Questions\n\n## Array\n\n- [x] [Two Sum](https://leetcode.com/problems/two-sum): [Solution](/cod"
},
{
"path": "coding_interviews/coding_interview_questions/common_elements.py",
"chars": 771,
"preview": "def common_elements(list1, list2):\n result = []\n elements = {}\n\n for item in list1:\n elements[item] = 1\n"
},
{
"path": "coding_interviews/coding_interview_questions/decode-string/decode-string.js",
"chars": 742,
"preview": "const isNum = (char) => !isNaN(Number(char));\n\nexport function decodeString(encodedString) {\n const stack = [];\n let i"
},
{
"path": "coding_interviews/coding_interview_questions/decode-string/tests/decode-string.test.js",
"chars": 1282,
"preview": "import { describe, it, expect } from 'vitest';\nimport { decodeString } from '../decode-string';\n\ndescribe('decodeString'"
},
{
"path": "coding_interviews/coding_interview_questions/mine_swipper.py",
"chars": 1954,
"preview": "# [[0, 0], [0, 1]], 3, 4\n# => [\n# [-1, -1, 1, 0],\n# [2, 2, 1, 0],\n# [0, 0, 0, 0]\n# ]\n\ndef update_table_spo"
},
{
"path": "coding_interviews/coding_interview_questions/most_frequently_occurring.py",
"chars": 869,
"preview": "def most_frequent(given_list):\n max_item = 0\n result = 0\n\n if not given_list:\n return None\n\n frequenc"
},
{
"path": "coding_interviews/coding_interview_questions/non_repeating.py",
"chars": 700,
"preview": "# 'aabcb' --> 'c'\n# 'xxyz' --> 'y'\n# '' --> None\n# 'aabb' --> None\n# 'abcab' --> 'c'\n# 'abab' --> None\n# 'aabbbc' --> 'c"
},
{
"path": "coding_interviews/coding_interview_questions/nth_element_from_the_end.py",
"chars": 1535,
"preview": "# Use this class to create linked lists.\nclass Node:\n def __init__(self, value, next=None):\n self.value = valu"
},
{
"path": "coding_interviews/coding_interview_questions/one_away_strings.py",
"chars": 1860,
"preview": "# 'abcde'\n# 'abfde'\n# => True\n\n# 'abcde'\n# 'abde'\n# => True\n\n# 'abde'\n# 'abfde'\n# => True\n\ndef handle_different_sized_st"
},
{
"path": "coding_interviews/coding_interview_questions/optimized_common_elements.py",
"chars": 941,
"preview": "def common_elements(list1, list2):\n result = []\n point1 = 0\n point2 = 0\n\n while point1 < len(list1) and poin"
},
{
"path": "coding_interviews/coding_interview_questions/rotation_array.py",
"chars": 716,
"preview": "# both arrays are the same size? => true\n# is A and B is equal, is A a rotation of B? => false\n# is both array is empty,"
},
{
"path": "coding_interviews/coding_interview_questions/two-crystal-balls/index.js",
"chars": 372,
"preview": "export function twoCrystalBalls(breaks) {\n let jumpAmount = Math.floor(Math.sqrt(breaks.length));\n let index = jumpAmo"
},
{
"path": "coding_interviews/coding_interview_questions/two-crystal-balls/tests/index.test.js",
"chars": 434,
"preview": "import { describe, expect, it } from 'vitest';\nimport { twoCrystalBalls } from '..';\n\ndescribe('twoCrystalBalls', () => "
},
{
"path": "coding_interviews/cracking-the-coding-interview/README.md",
"chars": 278,
"preview": "# Cracking the Coding Interview\n\n## Chapter 001: Arrays and Strings\n\n- [1.1 Is Unique](./chapter-001/is-unique)\n- [1.2 C"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/aditional1.py",
"chars": 136,
"preview": "def product(a, b):\n sum = 0\n for i in range(b):\n sum += a\n\n return sum\n\nprint(product(2, 4))\n\n# Complexi"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/aditional2.py",
"chars": 206,
"preview": "def power(a, b):\n if b < 0:\n return 0\n elif b == 0:\n return 1\n else:\n return a * power(a, "
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/aditional3.py",
"chars": 296,
"preview": "def mod(a, b):\n if b > a:\n return a\n\n return mod(a - b, b)\n\nprint(mod(10, 2))\nprint(mod(10, 3))\nprint(mod(1"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/aditional4.py",
"chars": 214,
"preview": "def div(a, b):\n count = 0\n sum = b\n\n while sum <= a:\n sum += b\n count += 1\n\n return count\n\npri"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/aditional5.py",
"chars": 443,
"preview": "def sqrt(n):\n return sqrt_helper(n, 1, n)\n\ndef sqrt_helper(n, min, max):\n if min > max:\n return -1\n\n gue"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/aditional6.py",
"chars": 306,
"preview": "from math import sqrt\n\ndef square_root(n):\n for guess in range(int(sqrt(n))+1):\n if guess * guess == n:\n "
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example1.py",
"chars": 428,
"preview": "def foo(array):\n sum = 0\n product = 1\n\n for element in array:\n sum += element\n\n for element in array:"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example10.py",
"chars": 460,
"preview": "from math import sqrt\n\ndef is_prime(num):\n if num < 2:\n return False\n\n if num == 2:\n return True\n\n "
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example11.py",
"chars": 163,
"preview": "def factorial(n):\n if n < 0:\n return -1\n\n if n == 0:\n return 1\n\n return n * factorial(n - 1)\n\n# f"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example12.py",
"chars": 292,
"preview": "def permutation(str):\n handle_permutation(str, \"\")\n\ndef handle_permutation(str, prefix):\n if len(str) == 0:\n "
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example13.py",
"chars": 171,
"preview": "def fib(n):\n if n == 0:\n return 0\n\n if n == 1:\n return 1\n\n return fib(n - 1) + fib(n - 2)\n\nprint("
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example14.py",
"chars": 216,
"preview": "def all_fib(n):\n for i in range(n):\n print(fib(i))\n\ndef fib(n):\n if n == 0:\n return 0\n\n if n == 1"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example15.py",
"chars": 353,
"preview": "def all_fib(n):\n memo = []\n memo.append(0)\n memo.append(1)\n\n for i in range(n):\n print(\"%d: %d\" %(i, "
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example16.py",
"chars": 242,
"preview": "def powers_of_2(n):\n if n <= 0:\n return 0\n\n if n == 1:\n print(1)\n return 1\n\n previous = po"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example2.py",
"chars": 287,
"preview": "def print_pairs(array):\n for i in array:\n for j in array:\n print(\"%d, %d\" %(i, j))\n\nprint_pairs([1,"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example3.py",
"chars": 442,
"preview": "def print_unordered_pairs(array):\n for i in range(len(array)):\n for j in range(i+1, len(array)):\n p"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example4.py",
"chars": 389,
"preview": "def print_unordered_pairs(array_a, array_b):\n for a in array_a:\n for b in array_b:\n if a < b:\n "
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example5.py",
"chars": 434,
"preview": "def print_unordered_pairs(array_a, array_b):\n for a in array_a:\n for b in array_b:\n for i in range("
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example6.py",
"chars": 461,
"preview": "def reverse(array):\n for i in range(len(array) / 2):\n index = len(array) - i - 1\n temporary_num = array"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example7.py",
"chars": 121,
"preview": "# O(N + P), if P < N / 2 --> O(N)\n# O(2N) --> O(N)\n# O(N + logN) --> O(N)\n# O(N + M), if N > M then O(N), otherwise O(M)"
},
{
"path": "coding_interviews/cracking-the-coding-interview/big_o/example9.py",
"chars": 175,
"preview": "def sum(node):\n if node is None:\n return 0\n\n return sum(node.left) + node.value + sum(node.right)\n\n# If we "
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/check-permutation/check-permutation.js",
"chars": 1092,
"preview": "// Given two strings, write a method to decide if one is a permutation of the other\n\n// If they have different lengths, "
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/check-permutation/check-permutation.test.js",
"chars": 466,
"preview": "import { describe, expect, it } from 'vitest';\nimport { checkPermutation } from './check-permutation';\n\ndescribe('checkP"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/cpp/remove_specified_character.cpp",
"chars": 430,
"preview": "#include <iostream>\n#include <string>\n\nusing namespace std;\n\nint main() {\n\n\tstring word, characteres, result = \"\";\n\n\tget"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/is-unique/is-unique.js",
"chars": 2382,
"preview": "// Is Unique: Implement an algorithm to determine if a string has all unique characters.\n\n// Using a hashmap to count th"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/is-unique/is-unique.test.js",
"chars": 1557,
"preview": "import { describe, expect, it } from 'vitest';\nimport {\n isUnique,\n isUniqueNSquare,\n isUniqueWithSet,\n isUniqueWith"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/one-away/one-away.js",
"chars": 1307,
"preview": "// One Away: There are three types of edits that can be performed on strings: insert a character, remove a character, or"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/one-away/one-away.test.js",
"chars": 610,
"preview": "import { describe, expect, it } from 'vitest';\nimport { oneAway } from './one-away';\n\ndescribe('oneAway', () => {\n it('"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/palindrome-permutation/palindrome-permutation.js",
"chars": 1207,
"preview": "// Palindrome Permutation: Given a string, write a function to check if it is a permutation of a palindrome.\n// A palind"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/palindrome-permutation/palindrome-permutation.test.js",
"chars": 580,
"preview": "import { describe, expect, it } from 'vitest';\nimport { palindromePermutation } from './palindrome-permutation';\n\ndescri"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/python/001.01.py",
"chars": 1259,
"preview": "'''\nIs Unique: Implement an algorithm to determine if a string has all unique characters.\nWhat if you cannot use additio"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/python/001.02.py",
"chars": 1883,
"preview": "'''\nCheck Permutation: Given two strings, write a method to decide if one is a\npermutation of the other.\n\n- Examples:\n\"a"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/python/001.03.py",
"chars": 703,
"preview": "'''\nURLify: Write a method to replace all spaces in a string with '%20'.\nYou may assume that the string has sufficient s"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/python/001.04.py",
"chars": 1386,
"preview": "'''\nPalindrome Permutation: Given a string, write a function to check if it is a permutation of a palindrome.\nA palindro"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/python/001.05.py",
"chars": 1947,
"preview": "'''\nOne Away: There are three types of edits that can be performed on strings:\ninsert a character, remove a character, o"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/python/001.06.py",
"chars": 1142,
"preview": "'''\nString Compression: Implement a method to perform basic string compression using the\ncounts of repeated characters. "
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/python/001.07.py",
"chars": 186,
"preview": "'''\nRotate Matrix: Given an image represented by an NxN matrix,\nwhere each pixel in the image is 4 bytes,\nwrite a method"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/python/bottlenecks.py",
"chars": 597,
"preview": "'''\nExample: Given an array of distinct integer values, count the number of pairs of integers that\nhave difference k. Fo"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/python/is_unique.py",
"chars": 1568,
"preview": "import time\nimport unittest\nfrom collections import defaultdict\n\n\ndef is_unique_chars_using_dictionary(text):\n char_c"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/string-compression/string-compression.js",
"chars": 815,
"preview": "// String Compression: Implement a method to perform basic string compression using the counts of repeated characters.\n/"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/urlify/urlify.js",
"chars": 1379,
"preview": "// URLlify: Write a method to replace all spaces in a string with '%20'.\n// You may assume that the string has sufficien"
},
{
"path": "coding_interviews/cracking-the-coding-interview/chapter-001/urlify/urlify.test.js",
"chars": 383,
"preview": "import { describe, expect, it } from 'vitest';\nimport { urlify, urlifyForward } from './urlify';\n\ndescribe('urlify', () "
},
{
"path": "coding_interviews/daily_code_problems/001.py",
"chars": 1097,
"preview": "\"\"\"\nGiven a list of numbers and a number k, return whether any two numbers from the list add up to k.\n\nFor example, give"
},
{
"path": "coding_interviews/daily_code_problems/002.py",
"chars": 877,
"preview": "\"\"\"\nGiven an array of integers,\nreturn a new array such that each element at index i of the new\narray is the product of "
},
{
"path": "coding_interviews/daily_code_problems/003.py",
"chars": 1777,
"preview": "'''\nGiven the root to a binary tree, implement serialize(root),\nwhich serializes the tree into a string, and deserialize"
},
{
"path": "coding_interviews/daily_code_problems/004.py",
"chars": 949,
"preview": "'''\nGiven an array of integers, find the first missing positive integer in linear time and constant space.\nIn other word"
},
{
"path": "coding_interviews/daily_code_problems/005.py",
"chars": 649,
"preview": "'''\ncons(a, b) constructs a pair, and car(pair) and cdr(pair)\nreturns the first and last element of that pair.\n\nFor exam"
},
{
"path": "coding_interviews/daily_code_problems/006.py",
"chars": 538,
"preview": "'''\nAn XOR linked list is a more memory efficient doubly linked list.\nInstead of each node holding next and prev fields,"
},
{
"path": "coding_interviews/daily_code_problems/007.py",
"chars": 532,
"preview": "'''\nGiven the mapping a = 1, b = 2, ... z = 26, and an encoded message,\ncount the number of ways it can be decoded.\n\nFor"
},
{
"path": "coding_interviews/daily_code_problems/README.md",
"chars": 180,
"preview": "# Daily Code Problem\n\n- [001](001.py)\n- [002](002.py)\n- [003](003.py)\n- [004](004.py)\n- [005](005.py)\n- [006](006.py)\n- "
},
{
"path": "coding_interviews/elements_of_programming_interview/array.py",
"chars": 504,
"preview": "# Your input is an array of\n# integers, and you have to reorder its entries\n# so that the even entries appear first.\n\nde"
},
{
"path": "coding_interviews/elements_of_programming_interview/base_conversion.py",
"chars": 863,
"preview": "'''\n\"615\"\n\n\"5\" --> 5 --> 5 * (7 ** 0)\n\"1\" --> 1 --> 1 * (7 ** 1)\n\"6\" --> 6 --> 6 * (7 ** 2)\n\n=> 306\n\n306 % 13 = 7\n306 / "
},
{
"path": "coding_interviews/elements_of_programming_interview/buy_and_sell_stock_once.py",
"chars": 481,
"preview": "# Buy and Sell stoks once\n\ndef buy_and_sell_stock_once(prices):\n if not prices:\n return 0\n\n min_price, max_"
},
{
"path": "coding_interviews/elements_of_programming_interview/can_reach_end.py",
"chars": 1567,
"preview": "\"\"\"\nIn a particular board game, a player has to try to advance through a sequence of positions.\nEach position has a nonn"
},
{
"path": "coding_interviews/elements_of_programming_interview/delete_duplicates_from_a_sorted_array.py",
"chars": 1699,
"preview": "# input: [2,3,5,5,7,11,11,11,13]\n# output: [2,3,5,7,11,13,0,0,0]\n\n# input: [-2,-2,1]\n# output: [-2,1,0]\n\n# input: [0,0,1"
},
{
"path": "coding_interviews/elements_of_programming_interview/interconvert_string_and_integer.py",
"chars": 835,
"preview": "# Interconvert String and Integer\n\n'''\n\"123\" => 123\n\"-123\" => -123\n'''\n\ndef to_int(string):\n sign = 1\n \n if str"
},
{
"path": "coding_interviews/elements_of_programming_interview/longest_subarray_length_with_same_integers.py",
"chars": 858,
"preview": "'''\nWrite a program that takes an array of integers and finds\nthe length of a longest subarray all of whose entries are "
},
{
"path": "coding_interviews/elements_of_programming_interview/multiply_two_arbitrary_precision_integers.py",
"chars": 617,
"preview": "# Write a program that takes two arrays representing integers,\n# and retums an integer representing their product\n\n\"\"\"\n1"
},
{
"path": "coding_interviews/elements_of_programming_interview/spreadsheet_column_encoding.py",
"chars": 590,
"preview": "encoding_mapper = {\n 'A': 1,\n 'B': 2,\n 'C': 3,\n 'D': 4,\n 'E': 5,\n 'F': 6,\n 'G': 7,\n 'H': 8,\n "
},
{
"path": "coding_interviews/hackerrank_interview_prep_kit/hash_tables/count_triplets.py",
"chars": 1197,
"preview": "# https://www.hackerrank.com/challenges/count-triplets-1/problem?h_l=interview&h_r=next-challenge&h_r%5B%5D%5B%5D%5B%5D="
},
{
"path": "coding_interviews/hackerrank_interview_prep_kit/hash_tables/ransom_note.py",
"chars": 1123,
"preview": "# https://www.hackerrank.com/challenges/ctci-ransom-note/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparatio"
},
{
"path": "coding_interviews/hackerrank_interview_prep_kit/hash_tables/sherlock_and_anagrams.py",
"chars": 1078,
"preview": "# https://www.hackerrank.com/challenges/sherlock-and-anagrams/problem?h_l=interview&h_r%5B%5D=next-challenge&h_r%5B%5D=n"
},
{
"path": "coding_interviews/hackerrank_interview_prep_kit/hash_tables/two_strings.py",
"chars": 793,
"preview": "# https://www.hackerrank.com/challenges/two-strings/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit"
},
{
"path": "coding_interviews/hackerrank_interview_prep_kit/warmup/counting_valleys.py",
"chars": 770,
"preview": "# https://www.hackerrank.com/challenges/counting-valleys/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparatio"
},
{
"path": "coding_interviews/hackerrank_interview_prep_kit/warmup/jumping_on_the_clouds.py",
"chars": 954,
"preview": "# https://www.hackerrank.com/challenges/jumping-on-the-clouds/problem?h_l=interview&playlist_slugs%5B%5D=interview-prepa"
},
{
"path": "coding_interviews/hackerrank_interview_prep_kit/warmup/repeated_string.py",
"chars": 947,
"preview": "# https://www.hackerrank.com/challenges/repeated-string/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation"
},
{
"path": "coding_interviews/hackerrank_interview_prep_kit/warmup/sales_by_match.py",
"chars": 765,
"preview": "# https://www.hackerrank.com/challenges/sock-merchant/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-k"
},
{
"path": "coding_interviews/interviews/fair/decrementBinaryNumber.js",
"chars": 608,
"preview": "function countOnes(number) {\n let counter = 0;\n\n number.split('').forEach((char) => {\n if (char === '1') counter++;"
},
{
"path": "coding_interviews/interviews/fair/diceTotalScore.js",
"chars": 251,
"preview": "function diceTotalScore(a, b, c) {\n if (a === b && b === c) {\n return 1000 * a;\n }\n\n if (a === b) {\n return 500"
},
{
"path": "coding_interviews/interviews/fair/isSubmatrixFull.js",
"chars": 371,
"preview": "function isSubmatrixFull(numbers) {\n const answer = [];\n\n for (let i = 0; i < numbers[0].length - 2; i++) {\n const "
},
{
"path": "coding_interviews/interviews/fair/sortChessSubsquares.js",
"chars": 857,
"preview": "function sortChessSubsquares(numbers, queries) {\n queries.forEach(([x, y, w]) => {\n const blacks = [];\n const whi"
},
{
"path": "coding_interviews/interviews/google/printSequence/printSequence.js",
"chars": 560,
"preview": "/*\nnumber of rows: 4\nnumber of columns: 5\n\nPrint this:\n1 8 9 16 17\n2 7 10 15 18\n3 6 11 14 19\n4 5 12 13 20 \n*/\n\nfunction"
},
{
"path": "coding_interviews/interviews/mercari/cumulativeSum.js",
"chars": 135,
"preview": "const cumulativeSum = (arr, sum = 0) =>\n arr.map((number) => {\n sum += number;\n return sum;\n });\n\ncumulativeSum("
},
{
"path": "coding_interviews/interviews/mercari/findMaxMin.js",
"chars": 275,
"preview": "const arr = [1, 2, 3, 4, 100];\n\nconst findMaxMin = (arr = []) => {\n let min = Infinity;\n let max = -Infinity;\n\n arr.f"
},
{
"path": "coding_interviews/interviews/mercari/findSumPairs.js",
"chars": 321,
"preview": "let arr = [1, 5, 6, 1, 0, 1];\n\nconst findSumPairs = (arr, value) => {\n const lookup = {};\n const pairs = [];\n\n arr.fo"
},
{
"path": "coding_interviews/interviews/mercari/multipleDupesArray.js",
"chars": 420,
"preview": "const arr = [1, 1, 2, 3, 4, 5, 6, 7, 8, 6, 6, 7, 7, 7, 10, 10];\n\nconst multipleDupesArray = (arr) => {\n const counter ="
},
{
"path": "coding_interviews/interviews/mercari/products.js",
"chars": 1698,
"preview": "// Given the sample response:\n\n// data: {\n// items: [\n// {\n// id: 1,\n// name: \"Nike Shoes\",\n// p"
},
{
"path": "coding_interviews/interviews/mercari/removeDupes.js",
"chars": 103,
"preview": "const arr = [1, 1, 1, 1, 1, 1, 1];\n\nconst removeDupes = (arr) => [...new Set(arr)];\n\nremoveDupes(arr);\n"
},
{
"path": "coding_interviews/interviews/mercari/retries.js",
"chars": 941,
"preview": "/* Implement a retryAsync function that will call an asynchronous function and then\n * recall it again on failure until "
},
{
"path": "coding_interviews/interviews/meta/compareLettersInArray/compareLettersInArray.js",
"chars": 820,
"preview": "function hasSameLength(words, letters) {\n return words.length !== letters.length;\n}\n\nfunction isArray(arr) {\n return A"
},
{
"path": "coding_interviews/interviews/meta/flatten/flatten.js",
"chars": 388,
"preview": "// [1, [2, [ [3, 4], 5], 6]] => [1, 2, 3, 4, 5, 6]\n\nfunction flatten(arr) {\n const flatArray = [];\n\n arr.forEach((elem"
},
{
"path": "coding_interviews/interviews/meta/flatten/flatten2.js",
"chars": 767,
"preview": "// [1, [2, null, true, [ [3, 'NaN', 4, undefined], 5], false, 6, '7']] => [1, 2, 3, 4, 5, 6]\n\nfunction isString(str) {\n "
},
{
"path": "coding_interviews/interviews/quintoandar/quinto1.py",
"chars": 691,
"preview": "def group_by(parsed_phone, number):\n numbers_of_characters = len(parsed_phone)\n result_list = []\n\n for i in ran"
},
{
"path": "coding_interviews/interviews/quintoandar/quinto2.py",
"chars": 734,
"preview": "A = [0,3,3,7,5,3,11,1]\ntuple_a = [(index, el) for index, el in enumerate(A)]\nsorted_tuple = sorted(tuple_a, key=lambda x"
},
{
"path": "coding_interviews/interviews/quintoandar/quinto3.py",
"chars": 257,
"preview": "T = [80, 80, 1000000000, 80, 80, 80, 80, 80, 80, 123456789]\n\nnumber_of_shares = int(len(T) / 2)\nnumber_of_different_type"
},
{
"path": "coding_interviews/interviews/quintoandar/regions.js",
"chars": 1983,
"preview": "// Regions Map\n// We want to represent our operational area in memory and store it in a database.\n// The regions will be"
},
{
"path": "coding_interviews/interviews/smartnews/countries.js",
"chars": 1061,
"preview": "function solution(A) {\n let countries = buildCountriesMapper(A);\n let countriesCount = 0;\n\n for (let row = 0; row < A"
},
{
"path": "coding_interviews/interviews/smartnews/emiter.js",
"chars": 1284,
"preview": "/*\n Event Emiter\n 1. `on` & `emit`\n 2. `off`\n 3. `once`\n*/\n\nclass EventEmiter {\n events = {};\n\n on(eventName, fn) "
},
{
"path": "coding_interviews/interviews/smartnews/getTriplets.js",
"chars": 1309,
"preview": "// /**\n// * Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all uni"
},
{
"path": "coding_interviews/interviews/uber/longest-words.js",
"chars": 2248,
"preview": "// console.log('Hello world');\n\n// I would like you to write a function which takes two arguments: a list of words, each"
},
{
"path": "coding_interviews/interviews/uber/maxFrequency.js",
"chars": 497,
"preview": "export function maxFrequency(numbers) {\n let maxFrequencyNumber = -1;\n let result = -1;\n let numberToFrequencyMap = {"
},
{
"path": "coding_interviews/interviews/uber/permutations.js",
"chars": 1270,
"preview": "/*\n Input [2,3]\n Output: [\"AD\", \"BD\", \"CD\", \"AE\", \"BE\", \"CE\", \"AF\", \"BF\", \"CF\"], 9\n\n Input []\n Output: [], "
},
{
"path": "coding_interviews/interviews/uber/tests/maxFrequency.test.js",
"chars": 360,
"preview": "import { describe, expect, it } from 'vitest';\nimport { maxFrequency } from '../maxFrequency';\n\ndescribe('maxFrequency',"
},
{
"path": "coding_interviews/javascript/array/binary-search.js",
"chars": 927,
"preview": "function getMiddle(start, end) {\n return Math.floor((start + end) / 2);\n}\n\nfunction binarySearch(numbers, target) {\n l"
},
{
"path": "coding_interviews/javascript/array/slice.js",
"chars": 204,
"preview": "const list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\n\nlist.slice(0); // all elements: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nlist.slic"
},
{
"path": "coding_interviews/javascript/array/subarrays.js",
"chars": 366,
"preview": "function generateSubarrays(arr, start, end, result) {\n if (end == arr.length) return;\n else if (start > end) generateS"
},
{
"path": "coding_interviews/javascript/hashmap/iteration.js",
"chars": 508,
"preview": "let hashmap = {};\nlet numbers = [1, 2, 3, 4, 5, 1, 6, 1, 7, 0, 8, 9, 10, 0, 1];\n\nfor (let number of numbers) {\n if (has"
}
]
// ... and 1361 more files (download for full content)
About this extraction
This page contains the full source code of the imteekay/algorithms GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 1561 files (988.9 KB), approximately 373.4k tokens, and a symbol index with 2409 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.