GithubHelp home page GithubHelp logo

shuvrima / leetcode_problems_solution Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kaidul/leetcode_problems_solution

0.0 1.0 0.0 901 KB

Solutions to all problems of Leetcode online judge written in C++ and Java

C++ 99.98% Java 0.02%

leetcode_problems_solution's Introduction

Solutions to LeetCode Programming Problems

  1. 01 Matrix
  2. 132 Pattern
  3. 24 Game
  4. 3 Sum
  5. 3 Sum Closest
  6. 3 Sum Smaller
  7. 4 Sum
  8. 4 Sum II
  9. Add and Search Word Data structure design
  10. Add Binary
  11. Add digits
  12. Add One Row to Tree
  13. Add Strings
  14. Add Two Numbers
  15. Add Two Numbers II
  16. Additive Number
  17. Alien Dictionary
  18. All O one Data Structure
  19. Anagrams
  20. Arithmetic Slices
  21. Arithmetic Slices II - Subsequence
  22. Arranging Coins
  23. Array Nesting
  24. Array Partition I
  25. Assign Cookies
  26. Average of Levels in Binary Tree
  27. Balanced Binary Tree
  28. Base 7
  29. Baseball Game
  30. Basic Calculator
  31. Basic Calculator II
  32. Battleships in a Board
  33. Beautiful Arrangement
  34. Beautiful Arrangement II
  35. Best Meeting Point
  36. Best Time to Buy and Sell Stock
  37. Best Time to Buy and Sell Stock II
  38. Best Time to Buy and Sell Stock III
  39. Best Time to Buy and Sell Stock IV
  40. Best Time to Buy and Sell Stock with Cooldown
  41. Binary Number with Alternating Bits
  42. Binary Search Tree Iterator
  43. Binary Tree Inorder Traversal
  44. Binary Tree Level Order Traversal
  45. Binary Tree Level Order Traversal II
  46. Binary Tree Longest Consecutive Sequence
  47. Binary Tree Maximum Path Sum
  48. Binary tree paths
  49. Binary Tree Postorder Traversal
  50. Binary Tree Preorder Traversal
  51. Binary tree Right Side View
  52. Binary Tree Tilt
  53. Binary Tree Upside Down
  54. Binary Tree Vertical Order Traversal
  55. Binary Tree Zigzag Level Order Traversal
  56. Binary Watch
  57. Bitwise AND of Numbers Range
  58. Bomb Enemy
  59. Brick Wall
  60. bulb switcher
  61. Bulb Switcher II
  62. Bulls and Cows
  63. Burst Balloons
  64. Can I Win
  65. Can Place Flowers
  66. Candy
  67. Climbing Stairs
  68. Clone Graph
  69. Closest Binary Search Tree Value
  70. Closest Binary Search Tree Value II
  71. Coin Change
  72. Coin Change 2
  73. Combination Sum
  74. Combination Sum II
  75. Combination Sum III
  76. Combination Sum IV
  77. Combinations
  78. Combine Two Tables
  79. Compare Version Numbers
  80. Complex Number Multiplication
  81. Concatenated Words
  82. Consecutive Numbers
  83. Construct Binary Tree from Inorder and Postorder Traversal
  84. Construct Binary Tree from Inorder and Preorder Traversal
  85. Construct Binary Tree from String
  86. Construct String from Binary Tree
  87. Construct the Rectangle
  88. Container With Most Water
  89. Contains Duplicate
  90. Contains Duplicate II
  91. Contains Duplicate III
  92. Contiguous Array
  93. Continuous Subarray Sum
  94. Convert a Number to Hexadecimal
  95. Convert BST to Greater Tree
  96. Convert Sorted Array to Binary Search Tree
  97. Convert Sorted List to Binary Search Tree
  98. Convex Polygon
  99. Copy List with Random Pointer
  100. Count and Say
  101. Count Binary Substrings
  102. Count Complete Tree Nodes
  103. Count Numbers with Unique Digits
  104. Count of Range Sum
  105. Count of Smaller Numbers After Self
  106. Count primes
  107. Count Univalue Subtrees
  108. Counting Bits
  109. Course Schedule
  110. Course Schedule II
  111. Create Maximum Number
  112. Customers Who Never Order
  113. Cut Off Trees for Golf Event
  114. Data Stream as Disjoint Intervals
  115. Decode String
  116. Decode Ways
  117. Decode Ways II
  118. Degree of an Array
  119. Delete Duplicate Emails
  120. Delete Node in a BST
  121. Delete Node in a Linked List
  122. Delete Operation for Two Strings
  123. Department Highest Salary
  124. Design Hit Counter
  125. Design Phone Directory
  126. Design Search Autocomplete System
  127. Design Snake Game
  128. Design Tic-Tac-Toe
  129. Design Twitter
  130. Detect Capital
  131. Diagonal Traverse
  132. Diameter of Binary Tree
  133. Different Ways to Add Parentheses
  134. Distinct Subsequences
  135. Distribute Candies
  136. Divide Two Integers
  137. Dungeon Game
  138. Duplicate Emails
  139. Edit Distance
  140. Elimination Game
  141. Employee Importance
  142. Employees Earning More Than Their Managers
  143. Encode and Decode Strings
  144. Encode and Decode TinyURL
  145. Encode String with Shortest Length
  146. Equal Tree Partition
  147. Evaluate Division
  148. Evaluate Reverse Polish Notation
  149. Excel Sheet Column Number
  150. Excel Sheet Column Title
  151. Exclusive Time of Functions
  152. Expression Add Operators
  153. Factor Combinations
  154. Factorial Trailing Zeroes
  155. Find All Anagrams in a String
  156. Find All Duplicates in an Array
  157. Find All Numbers Disappeared in an Array
  158. Find Bottom Left Tree Value
  159. Find Duplicate File in System
  160. Find Duplicate Subtrees
  161. Find K Closest Elements
  162. Find K Pairs with Smallest Sums
  163. Find Largest Value in Each Tree Row
  164. Find Leaves of Binary Tree
  165. Find Median from Data Stream
  166. Find Minimum in Rotated Sorted Array
  167. Find Minimum in Rotated Sorted Array II
  168. Find Peak Element
  169. Find Permutation
  170. Find Right Interval
  171. Find the Celebrity
  172. Find the Difference
  173. Find the Duplicate Number
  174. First Bad Version
  175. First Missing Positive
  176. First Unique Character in a String
  177. Fizz Buzz
  178. Flatten 2D Vector
  179. Flatten Binary Tree to Linked List
  180. Flatten Nested List Iterator
  181. Flip Game
  182. Flip Game II
  183. Fraction to Recurring Decimal
  184. Freedom Trail
  185. Friend Circles
  186. Frog Jump
  187. Game of Life
  188. Gas Station
  189. Generalized Abbreviation
  190. Generate Parentheses
  191. Graph Valid Tree
  192. Gray Code
  193. Group Shifted Strings
  194. Guess Number Higher or Lower
  195. Guess Number Higher or Lower II
  196. H-Index
  197. H-Indx II
  198. Hamming Distance
  199. Happy Numbers
  200. Heaters
  201. House Robber
  202. House Robber II
  203. House Robber III
  204. Image Smoother
  205. Implement Magic Dictionary
  206. Implement Stack using Queues
  207. Implement strStr()
  208. Implement Trie (Prefix Tree)
  209. Increasing Subsequences
  210. Increasing Triplet Subsequence
  211. Inorder Successor in BST
  212. Insert Delete GetRandom O(1)-Duplicates allowed
  213. Insert Delete GetRandom O(1)
  214. Insert Interval
  215. Insertion Sort List
  216. Integer Break
  217. Integer Replacement
  218. Integer to English Words
  219. Integer to Roman
  220. Interleaving String
  221. Intersection of Two Arrays
  222. Intersection of Two Arrays II
  223. Intersection of Two Linked Lists
  224. Invert Binary Tree
  225. Is Subsequence
  226. Island Perimeter
  227. Isomorphic Strings
  228. Judge Route Circle
  229. Jump Game
  230. Jump Game II
  231. K-diff Pairs in an Array
  232. K Empty Slots
  233. Keyboard Row
  234. Knight Probability in Chessboard
  235. Kth Largest Element in an Array
  236. Kth Smallest Element in a BST
  237. Kth Smallest Element in a Sorted Matrix
  238. Kth Smallest Number in Multiplication Table
  239. Largest BST Subtree
  240. Largest Divisible Subset
  241. Largest Number
  242. Largest Palindrome Product
  243. Largest Rectangle in Histogram
  244. Length of Last Word
  245. Letter Combinations of a Phone Number
  246. Lexicographical Numbers
  247. LFU Cache
  248. License Key Formatting
  249. Line Reflection
  250. Linked List Cycle
  251. Linked List Cycle II
  252. Linked List Random Node
  253. Logger Rate Limiter
  254. Lonely Pixel I
  255. Lonely Pixel II
  256. Longest Absolute File Path
  257. Longest Common Prefix
  258. Longest Consecutive Sequence
  259. Longest Continuous Increasing Subsequence
  260. Longest Harmonious Subsequence
  261. Longest Increasing Path in a Matrix
  262. Longest Increasing Subsequence
  263. Longest Palindrome
  264. Longest Palindromic Subsequence
  265. Longest Palindromic Substring
  266. Longest Repeating Character Replacement
  267. Longest Substrin with At Most K Distinct Characters
  268. Longest Substring with At Least K Repeating Characters
  269. Longest Substring with At Most Two Distinct Characters
  270. Longest Substring Without Repeating Characters
  271. Longest Uncommon Subsequence I
  272. Longest Uncommon Subsequence II
  273. Longest Univalue Path
  274. Longest Valid Parenthesis
  275. Longest Word in Dictionary through Deleting
  276. lowest common ancestor binary search tree
  277. lowest common ancestor binary tree
  278. LRU Cache
  279. Magical String
  280. Majority Element
  281. Majority Element II
  282. Map Sum Pairs
  283. Matchsticks to Square
  284. Max Area of Island
  285. Max Consecutive Ones
  286. Max Consecutive Ones II
  287. Max Points on a Line
  288. Max Sum of Rectangle No Larger Than K
  289. Maximal Rectangle
  290. Maximal Square
  291. Maximum Average Subarray I
  292. Maximum Average Subarray II
  293. Maximum Binary Tree
  294. Maximum Depth of Binary Tree
  295. Maximum Distance in Arrays
  296. Maximum Gap
  297. Maximum Length of Pair Chain
  298. Maximum Product of Three Numbers
  299. Maximum Product of Word Lengths
  300. Maximum Product Subarray
  301. Maximum Size Subarray Sum Equals k
  302. Maximum Subarray
  303. Maximum Sum of 3 Non-Overlapping Subarrays
  304. Maximum Swap
  305. Maximum Width of Binary Tree
  306. Maximum XOR of Two Numbers in an Array
  307. Median of Two Sorted Arrays
  308. Meeting Rooms
  309. Meeting Rooms II
  310. Merge Intervals
  311. Merge k Sorted Lists
  312. Merge Sorted Array
  313. Merge Two Binary Trees
  314. Merge Two Sorted Lists
  315. Min Stack
  316. Minesweeper
  317. Mini Parser
  318. Minimum Absolute Difference in BST
  319. Minimum Depth of Binary Tree
  320. Minimum Factorization
  321. Minimum Genetic Mutation
  322. Minimum Height Trees
  323. Minimum Moves to Equal Array Elements
  324. Minimum Moves to Equal Array Elements II
  325. Minimum Number of Arrows to Burst Balloons
  326. Minimum Path Sum
  327. Minimum Size Subarray Sum
  328. Minimum Time Difference
  329. Minimum Window Substring
  330. Missing Number
  331. Missing Ranges
  332. Most Frequent Subtree Sum
  333. Move zeros
  334. Moving Average from Data Stream
  335. Multiply Strings
  336. N-Queens II
  337. N Queens
  338. Nested List Weight Sum
  339. Next Closest Time
  340. Next Greater Element I
  341. Next Greater Element II
  342. Next Greater Element III
  343. Next Permutation
  344. Nim Game
  345. Non-decreasing Array
  346. Non-negative Integers without Consecutive Ones
  347. Non-overlapping Intervals
  348. Nth Digit
  349. Number Complement
  350. Number of 1 Bits
  351. Number of Boomerangs
  352. Number of Connected Components in an Undirected Graph
  353. Number of Digit One
  354. Number of Distinct Islands
  355. Number of Islands
  356. Number of Islands II
  357. Number of Longest Increasing Subsequence
  358. Number of Segments in a String
  359. Odd Even Linked List
  360. One Edit Distance
  361. Ones and Zeroes
  362. Optimal Division
  363. Output Contest Matches
  364. Pacific Atlantic Water Flow
  365. Paint House
  366. Paint House II
  367. Palindrome Linked List
  368. Palindrome Number
  369. Palindrome Pairs
  370. Palindrome Partitioning
  371. Palindrome Partitioning II
  372. Palindrome Permutation
  373. Palindrome Permutation II
  374. Palindromic Substrings
  375. Partition Equal Subset Sum
  376. Partition List
  377. Partition to K Equal Sum Subsets
  378. Pascal's Triangle
  379. Pascal's Triangle II
  380. Patching array
  381. Path Sum
  382. Path Sum II
  383. Path Sum III
  384. Peeking Iterator
  385. Perfect Number
  386. Perfect Rectangle
  387. Perfect Squares
  388. Permutation in String
  389. Permutation Sequence
  390. Permutations
  391. Permutations II
  392. Plus One
  393. Plus One Linked List
  394. Poor Pigs
  395. Populating Next Right Pointers in Each Node
  396. Populating Next Right Pointers in Each Node II
  397. Pow(x, n)
  398. Power of Four
  399. Power of Three
  400. Power of Two
  401. Predict the Winner
  402. Product of Array Except Self
  403. Queue Reconstruction by Height
  404. Random Pick Index
  405. Range Addition
  406. Range Sum Query-Mutable
  407. Range Sum Query 2D-Mutable
  408. Range Sum Query 2D Immutable
  409. Range Sum Query Immutable
  410. Rank Scores
  411. Ransom Note
  412. Read N Characters Given Read4
  413. Read N Characters Given Read4 II-Call multiple times
  414. Rearrange String k Distance Apart
  415. Reconstruct Itinerary
  416. Reconstruct Original Digits from English
  417. Recover Binary Search Tree
  418. Rectangle Area
  419. Redundant Connection
  420. Redundant Connection II
  421. Regular Expression Matching
  422. Relative Ranks
  423. Remove Boxes
  424. Remove Duplicate Letters
  425. Remove Duplicates from Sorted Array
  426. Remove Duplicates from Sorted Array II
  427. Remove Duplicates from Sorted List
  428. Remove Duplicates from Sorted List II
  429. Remove Element
  430. Remove Invalid Parentheses
  431. Remove K Digits
  432. Remove Linked List Elements
  433. Remove Nth Node From End of List
  434. Reorder List
  435. Repeated DNA Sequences
  436. Repeated String Match
  437. Repeated Substring Pattern
  438. Replace Words
  439. Reshape the Matrix
  440. Restore IP Addresses
  441. Reverse Bits
  442. Reverse Integer
  443. Reverse Linked List
  444. Reverse Linked List II
  445. Reverse Nodes in k-Group
  446. Reverse Pairs
  447. Reverse String
  448. Reverse String II
  449. Reverse Vowels of a String
  450. Reverse Words in a String
  451. Reverse Words in a String II
  452. Reverse Words in a String III
  453. Rising Temperature
  454. Roman to Integer
  455. Rotate Array
  456. Rotate Function
  457. Rotate Image
  458. Rotate List
  459. Russian Doll Envelopes
  460. Same Tree
  461. Scramble String
  462. Search a 2D Matrix
  463. Search a 2D Matrix II
  464. Search for a Range
  465. Search in Rotated Sorted Array
  466. Search in Rotated Sorted Array II
  467. Search Insert Position
  468. Second Highest Salary
  469. Second Minimum Node In a Binary Tree
  470. Self Crossing
  471. Sequence Reconstruction
  472. Serialize and Deserialize Binary Tree
  473. Serialize and Deserialize BST
  474. Set Matrix Zeroes
  475. Set Mismatch
  476. Shortest Distance from All Buildings
  477. Shortest Palindrome
  478. Shortest Unsorted Continuous Subarray
  479. Shortest Word Distance
  480. Shortest Word Distance II
  481. Shortest Word Distance III
  482. Shuffle an Array
  483. Simplify Path
  484. Single Element in a Sorted Array
  485. Single Number
  486. Single Number II
  487. Single Number III
  488. Sliding Window Maximum
  489. Sliding Window Median
  490. Smallest Good Base
  491. Smallest Rectangle Enclosing Black Pixels
  492. Sort Characters By Frequency
  493. Sort Colors
  494. Sort List
  495. Sort Transformed Array
  496. Sparse Matrix Multiplication
  497. Spiral Matrix
  498. Spiral Matrix II
  499. Split Array into Consecutive Subsequences
  500. Split Array Largest Sum
  501. Sqrt(x)
  502. Stickers to Spell Word
  503. String to Integer (atoi)
  504. Strobogrammatic Number
  505. Strobogrammatic Number II
  506. Strobogrammatic Number III
  507. Student Attendance Record I
  508. Student Attendance Record II
  509. Subarray Sum Equals K
  510. Subsets
  511. Subsets II
  512. Substring with Concatenation of All Words
  513. Subtree of Another Tree
  514. Sudoku Solver
  515. Sum of Left Leaves
  516. Sum of Two Integers
  517. Sum Root to Leaf Numbers
  518. Summary Ranges
  519. Super Pow
  520. Super Ugly Number
  521. Super Washing Machines
  522. Surrounded Regions
  523. Swap Nodes in Pairs
  524. Symmetric Tree
  525. target sum
  526. Task Scheduler
  527. Teemo Attacking
  528. Tenth Line
  529. Ternary Expression Parser
  530. Text Justification
  531. The Skyline Problem
  532. Third Maximum Number
  533. Top K Frequent Elements
  534. Top K Frequent Words
  535. Total Hamming Distance
  536. Trapping Rain Water
  537. Triangle
  538. Trim a Binary Search Tree
  539. Two Sum
  540. Two Sum II-Input array is sorted
  541. Two Sum III-Data structure design
  542. Two Sum IV - Input is a BST
  543. Ugly Number
  544. Ugly Number II
  545. Unique Binary Search Trees
  546. Unique Binary Search Trees II
  547. Unique Paths
  548. Unique Paths II
  549. Unique Substrings in Wraparound String
  550. Unique Word Abbreviation
  551. UTF-8 Validation
  552. Valid Anagram
  553. Valid Number
  554. Valid Palindrome
  555. Valid Palindrome II
  556. Valid Parentheses
  557. Valid Parenthesis String
  558. Valid Perfect Square
  559. Valid Phone Numbers
  560. Valid Square
  561. Valid Sudoku
  562. Valid Triangle Number
  563. Valid Word Abbreviation
  564. Valid Word Square
  565. Validate Binary Search Tree
  566. Validate IP Address
  567. Verify Preorder Sequence in Binary Search Tree
  568. Verify Preorder Serialization of a Binary Tree
  569. Walls and Gates
  570. Water and Jug Problem
  571. Wiggle Sort
  572. Wiggle Sort II
  573. Wiggle Subsequence
  574. Wildcard Matching
  575. Word Break
  576. Word Break II
  577. Word Frequency
  578. Word Ladder
  579. Word Ladder II
  580. Word Pattern
  581. Word Pattern II
  582. Word Search
  583. Word Search II
  584. Word Squares
  585. ZigZag Conversion
  586. Zigzag Iterator
  587. Zuma Game

leetcode_problems_solution's People

Contributors

kaidul avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.