Skip to content

Latest commit

Β 

History

History
569 lines (455 loc) Β· 18.3 KB

File metadata and controls

569 lines (455 loc) Β· 18.3 KB

LeetCode Questions & Solutions

There are multiple solutions for each question, these are my own solutions for these questions.

1. Two Sum

2. Add Two Numbers

3. Longest Substring Without Repeating Characters

4. Median of Two Sorted Arrays

5. Longest Palindromic Substring

6. Zigzag Conversion

7. Reverse Integer

8. String to Integer atoi

9. Palandrome Number

10. Regular Expression Matching

11. Container with Most Water

12. Integer to Roman

13. Roman to Integer

14. Longest Common Prefix

15. 3Sum

16. 3Sum Closest

17. Letter Combinations of a Phone Number

18. 4Sum

19. Remove Nth Node From End of List

20. Valid Parentheses

21. Merge Two Sorted Lists

22. Generate Parentheses

23. Merge k Sorted Lists

24. Swap Nodes in Pairs

25. Reverse Nodes in k Group

26. Remove Duplicates from Sorted Array

27. Remove Element

28. Find the Index of the First Occurrence in a String

29. Divide Two Integers

30. Substring with Concatenation of All Words

31. Next Permutation

32. Longest Valid Parentheses

33. Search in Rotated Sorted Array

34. Find First and Last Position of Element in Sorted Array

35. Search Insert Position

36. Valid Sudoku

37. Sudoku Solver

38. Count and Say

39. Combination Sum

40. Combination Sum II

41. First Missing Positive

42. Trapping Rain Water

43. Multiply Strings

44. Wildcard Matching

45. Jump Game II

46. Permutations

47. Permutations II

48. Rotate Image

49. Group Anagrams

50. Pow(x, n)

  • πŸ“„ [Question](Questions/50-Pow(x, n).md)
  • πŸ’» Solutions:
    • [Rust](Solutions/50-Pow(x, n).rs)
    • Rust

51. N Queens

52. NQueens II

53. Maximum Subarray

54. Spiral Matrix

55. Jump Game

56. Merge Intervals

57. Insert Interval

58. Length of Last Word

59. Spiral Matrix II

60. Permutation Sequence

61. Rotate List

62. Unique Paths

104. Maximum Depth of Binary Tree

115. Distinct Subsequences

182. Duplicate Emails

233. Number of Digit One

260. Single Number III

262. Trips and Users

391. Perfect Rectangle

559. Maximum Depth of N ary Tree

624. Maximum Distance in Arrays

768. Max Chunks To Make Sorted II

835. Image Overlap

983. Minimum Cost For Tickets

1416. Restore The Array

1422. Maximum Score After Splitting a String

1457. PseudoPalindromic Paths in a Binary Tree

1498. Number of Subsequences That Satisfy the Given Sum Condition

1672. Richest Customer Wealth

1712. Ways to Split Array Into Three Subarrays

1807. Evaluate the Bracket Pairs of a String

1864. Minimum Number of Swaps to Make the Binary String Alternating

1905. Count Sub Islands

2166. Design Bitset

2460. Apply Operations to an Array

2506. Count Pairs Of Similar Strings

2542. Maximum Subsequence Score

2614. Prime In Diagonal

2816. Double a Number Represented as a Linked List

2961. Double Modular Exponentiation

3020. Find the Maximum Number of Elements in Subset

3115. Maximum Prime Difference

3159. Find Occurrences of an Element in an Array

3365. Rearrange K Substrings to Form Target String

3374. First Letter Capitalization II

3375. Minimum Operations to Make Array Values Equal to K

3454. Separate Squares II

3455. Shortest Matching Substring

3543. Maximum Weighted K Edge Path

3754. Concatenate Non-Zero Digits and Multiply by Sum I

3755. Find Maximum Balanced XOR Subarray Length

3812. Minimum Edge Toggles on a Tree

3829. Design Ride Sharing System

3830. Longest Alternating Subarray After Removing At Most One Element

Test Codes

# Python
python3 ./<solution>.py

# java
javac "<solution>.java"
java <solution>

# Go
go run <solution>.go

# Rust
rustc <solution>.rs
./<solution>

# C++
g++ -o <executable> <solution>.cpp
./<executable>

# Typescript
npx ts-node "<solution>.ts"