Skip to content

My solutions for competitive programming questions on sites like leetcode , codeforces ...

Notifications You must be signed in to change notification settings

kalebalebachew/Competitive-programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A collection of LeetCode questions to ace the coding interview! - Created using LeetHub v2

LeetCode Topics

Array

0001-two-sum
0011-container-with-most-water
0015-3sum
0016-3sum-closest
0026-remove-duplicates-from-sorted-array
0027-remove-element
0035-search-insert-position
0046-permutations
0049-group-anagrams
0053-maximum-subarray
0088-merge-sorted-array
0121-best-time-to-buy-and-sell-stock
0128-longest-consecutive-sequence
0136-single-number
0167-two-sum-ii-input-array-is-sorted
0169-majority-element
0217-contains-duplicate
0229-majority-element-ii
0268-missing-number
0303-range-sum-query-immutable
0347-top-k-frequent-elements
0349-intersection-of-two-arrays
0350-intersection-of-two-arrays-ii
0442-find-all-duplicates-in-an-array
0448-find-all-numbers-disappeared-in-an-array
0500-keyboard-row
0560-subarray-sum-equals-k
0566-reshape-the-matrix
0643-maximum-average-subarray-i
0724-find-pivot-index
0921-spiral-matrix-iii
0924-fair-candy-swap
1019-squares-of-a-sorted-array
1044-find-common-characters
1046-max-consecutive-ones-iii
1168-duplicate-zeros
1319-unique-number-of-occurrences
1354-find-players-with-zero-or-one-losses
1370-count-number-of-nice-subarrays
1392-find-the-difference-of-two-arrays
1407-group-the-people-given-the-group-size-they-belong-to
1482-how-many-numbers-are-smaller-than-the-current-number
1510-find-lucky-integer-in-an-array
1528-kids-with-the-greatest-number-of-candies
1547-destination-city
1580-shuffle-the-array
1635-number-of-good-pairs
1656-count-good-triplets
1786-count-the-number-of-consistent-strings
1848-sum-of-unique-elements
2042-maximum-product-difference-between-two-pairs
2048-build-array-from-permutation
2058-concatenation-of-array
2116-count-number-of-pairs-with-absolute-difference-k
2137-final-value-of-variable-after-performing-operations
2159-two-out-of-three
2190-count-common-words-with-one-occurrence
2219-maximum-number-of-words-found-in-sentences
2231-find-first-palindromic-string-in-the-array
2421-maximum-number-of-pairs-in-array
2442-number-of-arithmetic-triplets
2448-count-number-of-bad-pairs
2480-find-subarrays-with-equal-sum
2502-sort-the-people
2917-count-pairs-whose-sum-is-less-than-target
3194-find-words-containing-character
3206-find-common-elements-between-two-arrays
3242-count-elements-with-maximum-frequency

Two Pointers

0011-container-with-most-water
0015-3sum
0016-3sum-closest
0026-remove-duplicates-from-sorted-array
0027-remove-element
0028-find-the-index-of-the-first-occurrence-in-a-string
0088-merge-sorted-array
0125-valid-palindrome
0151-reverse-words-in-a-string
0167-two-sum-ii-input-array-is-sorted
0202-happy-number
0344-reverse-string
0345-reverse-vowels-of-a-string
0349-intersection-of-two-arrays
0350-intersection-of-two-arrays-ii
0557-reverse-words-in-a-string-iii
1019-squares-of-a-sorted-array
1168-duplicate-zeros
1894-merge-strings-alternately
2128-reverse-prefix-of-word
2231-find-first-palindromic-string-in-the-array
2442-number-of-arithmetic-triplets
2917-count-pairs-whose-sum-is-less-than-target

Sorting

0015-3sum
0016-3sum-closest
0049-group-anagrams
0088-merge-sorted-array
0169-majority-element
0217-contains-duplicate
0229-majority-element-ii
0242-valid-anagram
0268-missing-number
0347-top-k-frequent-elements
0349-intersection-of-two-arrays
0350-intersection-of-two-arrays-ii
0389-find-the-difference
0692-top-k-frequent-words
0924-fair-candy-swap
1019-squares-of-a-sorted-array
1354-find-players-with-zero-or-one-losses
1482-how-many-numbers-are-smaller-than-the-current-number
2042-maximum-product-difference-between-two-pairs
2502-sort-the-people
2917-count-pairs-whose-sum-is-less-than-target

Hash Table

0001-two-sum
0003-longest-substring-without-repeating-characters
0013-roman-to-integer
0049-group-anagrams
0128-longest-consecutive-sequence
0169-majority-element
0202-happy-number
0217-contains-duplicate
0229-majority-element-ii
0242-valid-anagram
0268-missing-number
0290-word-pattern
0347-top-k-frequent-elements
0349-intersection-of-two-arrays
0350-intersection-of-two-arrays-ii
0383-ransom-note
0387-first-unique-character-in-a-string
0389-find-the-difference
0409-longest-palindrome
0424-longest-repeating-character-replacement
0442-find-all-duplicates-in-an-array
0448-find-all-numbers-disappeared-in-an-array
0500-keyboard-row
0560-subarray-sum-equals-k
0692-top-k-frequent-words
0782-jewels-and-stones
0920-uncommon-words-from-two-sentences
0924-fair-candy-swap
1044-find-common-characters
1297-maximum-number-of-balloons
1319-unique-number-of-occurrences
1354-find-players-with-zero-or-one-losses
1370-count-number-of-nice-subarrays
1392-find-the-difference-of-two-arrays
1407-group-the-people-given-the-group-size-they-belong-to
1482-how-many-numbers-are-smaller-than-the-current-number
1510-find-lucky-integer-in-an-array
1547-destination-city
1635-number-of-good-pairs
1786-count-the-number-of-consistent-strings
1848-sum-of-unique-elements
1873-longest-nice-substring
1960-check-if-the-sentence-is-pangram
2025-redistribute-characters-to-make-all-strings-equal
2116-count-number-of-pairs-with-absolute-difference-k
2159-two-out-of-three
2190-count-common-words-with-one-occurrence
2406-decode-the-message
2421-maximum-number-of-pairs-in-array
2427-first-letter-to-appear-twice
2442-number-of-arithmetic-triplets
2448-count-number-of-bad-pairs
2480-find-subarrays-with-equal-sum
2502-sort-the-people
3206-find-common-elements-between-two-arrays
3242-count-elements-with-maximum-frequency

String

0003-longest-substring-without-repeating-characters
0013-roman-to-integer
0014-longest-common-prefix
0020-valid-parentheses
0028-find-the-index-of-the-first-occurrence-in-a-string
0049-group-anagrams
0125-valid-palindrome
0151-reverse-words-in-a-string
0242-valid-anagram
0290-word-pattern
0344-reverse-string
0345-reverse-vowels-of-a-string
0383-ransom-note
0387-first-unique-character-in-a-string
0389-find-the-difference
0409-longest-palindrome
0412-fizz-buzz
0424-longest-repeating-character-replacement
0500-keyboard-row
0557-reverse-words-in-a-string-iii
0692-top-k-frequent-words
0742-to-lower-case
0782-jewels-and-stones
0920-uncommon-words-from-two-sentences
1044-find-common-characters
1205-defanging-an-ip-address
1297-maximum-number-of-balloons
1547-destination-city
1786-count-the-number-of-consistent-strings
1797-goal-parser-interpretation
1873-longest-nice-substring
1894-merge-strings-alternately
1960-check-if-the-sentence-is-pangram
2025-redistribute-characters-to-make-all-strings-equal
2076-sum-of-digits-of-string-after-convert
2128-reverse-prefix-of-word
2137-final-value-of-variable-after-performing-operations
2190-count-common-words-with-one-occurrence
2219-maximum-number-of-words-found-in-sentences
2231-find-first-palindromic-string-in-the-array
2406-decode-the-message
2427-first-letter-to-appear-twice
2502-sort-the-people
3194-find-words-containing-character

Dynamic Programming

0053-maximum-subarray
0070-climbing-stairs
0121-best-time-to-buy-and-sell-stock
1013-fibonacci-number

Divide and Conquer

0053-maximum-subarray
0169-majority-element
0347-top-k-frequent-elements
1873-longest-nice-substring

Counting

0169-majority-element
0229-majority-element-ii
0347-top-k-frequent-elements
0383-ransom-note
0387-first-unique-character-in-a-string
0692-top-k-frequent-words
1297-maximum-number-of-balloons
1354-find-players-with-zero-or-one-losses
1482-how-many-numbers-are-smaller-than-the-current-number
1510-find-lucky-integer-in-an-array
1635-number-of-good-pairs
1848-sum-of-unique-elements
2025-redistribute-characters-to-make-all-strings-equal
2116-count-number-of-pairs-with-absolute-difference-k
2190-count-common-words-with-one-occurrence
2421-maximum-number-of-pairs-in-array
2427-first-letter-to-appear-twice
2448-count-number-of-bad-pairs
3242-count-elements-with-maximum-frequency

Math

0009-palindrome-number
0013-roman-to-integer
0070-climbing-stairs
0202-happy-number
0268-missing-number
0412-fizz-buzz
1013-fibonacci-number
1370-count-number-of-nice-subarrays
1635-number-of-good-pairs
2448-count-number-of-bad-pairs
2491-smallest-even-multiple
2507-number-of-common-factors
2556-convert-the-temperature

Binary Search

0035-search-insert-position
0167-two-sum-ii-input-array-is-sorted
0268-missing-number
0349-intersection-of-two-arrays
0350-intersection-of-two-arrays-ii
0924-fair-candy-swap
1046-max-consecutive-ones-iii
2917-count-pairs-whose-sum-is-less-than-target

Bit Manipulation

0136-single-number
0268-missing-number
0389-find-the-difference
1786-count-the-number-of-consistent-strings
1873-longest-nice-substring
2159-two-out-of-three
2427-first-letter-to-appear-twice

Design

0303-range-sum-query-immutable

Prefix Sum

0303-range-sum-query-immutable
0560-subarray-sum-equals-k
0724-find-pivot-index
1046-max-consecutive-ones-iii

Simulation

0412-fizz-buzz
0566-reshape-the-matrix
0921-spiral-matrix-iii
2048-build-array-from-permutation
2058-concatenation-of-array
2076-sum-of-digits-of-string-after-convert
2137-final-value-of-variable-after-performing-operations

Enumeration

1656-count-good-triplets
2442-number-of-arithmetic-triplets
2507-number-of-common-factors

Number Theory

2491-smallest-even-multiple
2507-number-of-common-factors

Matrix

0566-reshape-the-matrix
0921-spiral-matrix-iii

Memoization

0070-climbing-stairs
1013-fibonacci-number

Linked List

0021-merge-two-sorted-lists

Recursion

0021-merge-two-sorted-lists
1013-fibonacci-number

Stack

0020-valid-parentheses

Backtracking

0046-permutations

String Matching

0028-find-the-index-of-the-first-occurrence-in-a-string

Trie

0014-longest-common-prefix
0692-top-k-frequent-words

Heap (Priority Queue)

0347-top-k-frequent-elements
0692-top-k-frequent-words

Bucket Sort

0347-top-k-frequent-elements
0692-top-k-frequent-words

Quickselect

0347-top-k-frequent-elements

Sliding Window

0003-longest-substring-without-repeating-characters
0424-longest-repeating-character-replacement
0643-maximum-average-subarray-i
1046-max-consecutive-ones-iii
1370-count-number-of-nice-subarrays
1873-longest-nice-substring

Union Find

0128-longest-consecutive-sequence

Queue

0387-first-unique-character-in-a-string

Greedy

0011-container-with-most-water
0409-longest-palindrome

About

My solutions for competitive programming questions on sites like leetcode , codeforces ...

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published