From c61044ea0d19082a686267f106dfcae6f1cb4639 Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Mon, 2 May 2022 21:57:35 +0200 Subject: [PATCH 01/94] CHORE : move all .py files to python/ dir --- 371-Sum-of-Two-Integers.java | 10 ---------- README.md | 4 ++++ 1-Two-Sum.py => python/1-Two-Sum.py | 0 .../10-Regular-Expression-Matching.py | 0 100-Same-Tree.py => python/100-Same-Tree.py | 0 .../102-Binary-Tree-Level-Order-Traversal.py | 0 .../104-Maximum-Depth-of-Binary-Tree.py | 0 .../1046-Last-Stone-Weight.py | 0 ...-Binary-Tree-from-Preorder-and-Inorder-Traversal.py | 0 .../11-Container-With-Most-Water.py | 0 .../110-Balanced-Binary-Tree.py | 0 .../1143-Longest-Common-Subsequence.py | 0 .../115-Distinct-Subsequences.py | 0 .../12-Integer-To-Roman.py | 0 .../121-Best-Time-To-Buy-and-Sell-Stock.py | 0 ...-of-a-Concatenated-String-with-Unique-Characters.py | 0 .../124-Binary-Tree-Maximum-Path-Sum.py | 0 .../125-Valid-Palindrome.py | 0 127-Word-Ladder.py => python/127-Word-Ladder.py | 0 .../128-Longest-consecutive-sequence.py | 0 .../13-Roman-To-Integer.py | 0 .../130-Surrounded-Regions.py | 0 .../131-Palindrome-Partitioning.py | 0 133-Clone-Graph.py => python/133-Clone-Graph.py | 0 134-Gas-Station.py => python/134-Gas-Station.py | 0 136-Single-Number.py => python/136-Single-Number.py | 0 .../138-Copy-List-With-Random-Pointer.py | 0 139-Word-Break.py => python/139-Word-Break.py | 0 .../141-Linked-List-Cycle.py | 0 143-Reorder-List.py => python/143-Reorder-List.py | 0 .../1448-Count-Good-Nodes-in-Binary-Tree.py | 0 146-LRU-Cache.py => python/146-LRU-Cache.py | 0 15-3Sum.py => python/15-3Sum.py | 0 .../150-Evaluate-Reverse-Polish-Notation.py | 0 .../152-Maximum-Product-Subarray.py | 0 .../153-Find-Minimum-in-Rotated-Sorted-Array.py | 0 155-Min-Stack.py => python/155-Min-Stack.py | 0 .../1584-Min-Cost-to-Connect-all-Points.py | 0 .../160-Intersection-of-Two-Linked-Lists.py | 0 167-Two-Sum-II.py => python/167-Two-Sum-II.py | 0 .../17-Letter-Combinations-of-a-Phone-Number.py | 0 .../1851-Minimum-Interval-to-Include-Each-Query.py | 0 .../1899-Merge-Triplets-to-Form-Target-Triplet.py | 0 .../19-Remove-Nth-node-from-end-of-List.py | 0 190-Reverse-Bits.py => python/190-Reverse-Bits.py | 0 .../1905-Count-Sub-Islands.py | 0 .../191-Number-of-1-Bits.py | 0 198-House-Robber.py => python/198-House-Robber.py | 0 .../199-Binary-Tree-Right-Side-View.py | 0 2-Add-Two-Numbers.py => python/2-Add-Two-Numbers.py | 0 .../20-Valid-Parentheses.py | 0 .../200-Number-of-Islands.py | 0 .../2013-Detect-Squares.py | 0 202-Happy-Number.py => python/202-Happy-Number.py | 0 .../206-Reverse-Linked-List.py | 0 .../207-Course-Schedule.py | 0 208-Implement-Trie.py => python/208-Implement-Trie.py | 0 .../21-Merge-Two-Sorted-Lists.py | 0 .../210-Course-Schedule-II.py | 0 .../211-Design-Add-and-Search-Words-Data-Structure.py | 0 212-Word-Search-II.py => python/212-Word-Search-II.py | 0 .../213-House-Robber-II.py | 0 .../215-Kth-Largest-Element-in-an-Array.py | 0 .../217-Contains-Duplicate.py | 0 .../22-Generate-Parentheses.py | 0 221-Maximal-Square.py => python/221-Maximal-Square.py | 0 .../226-Invert-Binary-Tree.py | 0 .../23-Merge-K-Sorted-Lists.py | 0 .../230-Kth-Smallest-Element-in-a-BST.py | 0 .../236-Lowest-Common-Ancestor-of-a-Binary-Tree.py | 0 .../238-Product-of-array-except-self.py | 0 .../239-Sliding-Window-Maximum.py | 0 .../24-Swap-Nodes-in-Pairs.py | 0 242-Valid-Anagrams.py => python/242-Valid-Anagrams.py | 0 .../25-Reverse-Nodes-in-K-Group.py | 0 252-Meeting-Rooms.py => python/252-Meeting-Rooms.py | 0 .../253-Meeting-Rooms-ii.py | 0 .../261-Graph-Valid-Tree.py | 0 268-Missing-Number.py => python/268-Missing-Number.py | 0 .../271-Encode-and-Decode-Strings.py | 0 .../28-Implement-strStr.py | 0 .../286-Walls-and-Gates.py | 0 .../287-Find-The-Duplicate-Number.py | 0 .../295-Find-Median-from-Data-Stream.py | 0 .../297-Serialize-and-Deserialize-Binary-Tree.py | 0 ...3-Longest-Substring-Without-Repeating-Characters.py | 0 .../300-Longest-Increasing-Subsequence.py | 0 ...09-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.py | 0 312-Burst-Balloons.py => python/312-Burst-Balloons.py | 0 322-Coin-Change.py => python/322-Coin-Change.py | 0 .../329-Longest-Increasing-Path-in-a-Matrix.py | 0 .../33-Search-In-Rotated-Sorted-Array.py | 0 .../332-Reconstruct-Itinerary.py | 0 338-Counting-Bits.py => python/338-Counting-Bits.py | 0 ...rst-and-Last-Position-of-Element-in-Sorted-Array.py | 0 .../347-Top-k-frequent-elements.py | 0 355-Design-Twitter.py => python/355-Design-Twitter.py | 0 36-Valid-Sudoku.py => python/36-Valid-Sudoku.py | 0 .../371-Sum-of-Two-Integers.py | 0 .../377-Combination-Sum-IV.py | 0 39-Combination-Sum.py => python/39-Combination-Sum.py | 0 394-decode-string.py => python/394-decode-string.py | 0 .../4-median-of-two-sorted-arrays.py | 0 .../40-Combination-Sum-II.py | 0 .../40-Combinations-Sum-ii.py | 0 .../410-Split-Array-Largest-Sum.py | 0 .../416-Partition-Equal-Subset-Sum.py | 0 .../417-Pacific-Atlantic-Waterflow.py | 0 .../42-Trapping-Rain-Water.py | 0 .../424-Longest-Repeating-Character-Replacement.py | 0 .../43-Multiply-Strings.py | 0 .../435-Non-Overlapping-Intervals.py | 0 .../448-Find-all-Numbers-Disappeared-in-an-Array.py | 0 45-Jump-Game-II.py => python/45-Jump-Game-II.py | 0 46-Permutations.py => python/46-Permutations.py | 0 .../463-Island-Perimeter.py | 0 .../473-Matchsticks-to-Square.py | 0 48-Rotate-Image.py => python/48-Rotate-Image.py | 0 49-Group-Anagrams.py => python/49-Group-Anagrams.py | 0 494-Target-Sum.py => python/494-Target-Sum.py | 0 .../5-Longest-Palindromic-Substring.py | 0 50-Pow(x, n) => python/50-Pow(x, n) | 0 51-N-Queens.py => python/51-N-Queens.py | 0 518-coin-change-2.py => python/518-coin-change-2.py | 0 .../53-Maximum-Subarray.py | 0 54-Spiral-Matrix.py => python/54-Spiral-Matrix.py | 0 .../543-Diameter-of-Binary-Tree.py | 0 55-Jump-Game.py => python/55-Jump-Game.py | 0 56-Merge-Intervals.py => python/56-Merge-Intervals.py | 0 .../567-Permutation-in-String.py | 0 57-Insert-Interval.py => python/57-Insert-Interval.py | 0 .../572-Subtree-of-Another-Tree.py | 0 .../617-Merge-Two-Binary-Trees.py | 0 62-Unique-Paths.py => python/62-Unique-Paths.py | 0 621-Task-Scheduler.py => python/621-Task-Scheduler.py | 0 .../647-Palindromic-Substrings.py | 0 .../658-Find-K-Closest-Elements.py | 0 66-Plus-One.py => python/66-Plus-One.py | 0 .../673-Number-of-Longest-Increasing-Subsequence.py | 0 .../678-Valid-Parenthesis-String.py | 0 .../684-Redundant-Connection.py | 0 .../695-Max-Area-of-Island.py | 0 7-Reverse-Integer.py => python/7-Reverse-Integer.py | 0 70-Climbing-Stairs.py => python/70-Climbing-Stairs.py | 0 .../703-Kth-Largest-Element-in-a-Stream.py | 0 704-Binary-Search.py => python/704-Binary-Search.py | 0 72-Edit-Distance.py => python/72-Edit-Distance.py | 0 .../724-Find-Pivot-Index.py | 0 .../73-Set-Matrix-Zeroes.py | 0 .../739-Daily-Temperatures.py | 0 .../74-Search-a-2D-Matrix.py | 0 .../743-Network-Delay-Time.py | 0 .../746-Min-Cost-Climbing-Stairs.py | 0 752-Open-the-Lock.py => python/752-Open-the-Lock.py | 0 .../76-Minimum-Window-Substring.py | 0 .../763-Partition-Labels.py | 0 .../767-Reorganize-String.py | 0 .../778-Swim-in-Rising-Water.py | 0 78-Subsets.py => python/78-Subsets.py | 0 .../787-Cheapest-Flights-within-K-stops.py | 0 79-Word-Search.py => python/79-Word-Search.py | 0 .../84-Largest-Rectangle-in-Histogram.py | 0 .../846-Hand-of-Straights.py | 0 853-Car-Fleet.py => python/853-Car-Fleet.py | 0 .../875-Koko-Eating-Bananas.py | 0 90-Subsets-II.py => python/90-Subsets-II.py | 0 .../909-Snakes-and-Ladders.py | 0 91-Decode-ways.py => python/91-Decode-ways.py | 0 .../92-Reverse-Linked-List-II.py | 0 .../94-Binary-Tree-Inorder-Traversal.py | 0 .../97-Interleaving-Strings.py | 0 .../973-K-Closest-Points-to-Origin.py | 0 .../98-Validate-Binary-Search-Tree.py | 0 .../981-Time-Based-Key-Value-Store.py | 0 .../994-Rotting-Oranges.py | 0 175 files changed, 4 insertions(+), 10 deletions(-) delete mode 100644 371-Sum-of-Two-Integers.java rename 1-Two-Sum.py => python/1-Two-Sum.py (100%) rename 10-Regular-Expression-Matching.py => python/10-Regular-Expression-Matching.py (100%) rename 100-Same-Tree.py => python/100-Same-Tree.py (100%) rename 102-Binary-Tree-Level-Order-Traversal.py => python/102-Binary-Tree-Level-Order-Traversal.py (100%) rename 104-Maximum-Depth-of-Binary-Tree.py => python/104-Maximum-Depth-of-Binary-Tree.py (100%) rename 1046-Last-Stone-Weight.py => python/1046-Last-Stone-Weight.py (100%) rename 105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.py => python/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.py (100%) rename 11-Container-With-Most-Water.py => python/11-Container-With-Most-Water.py (100%) rename 110-Balanced-Binary-Tree.py => python/110-Balanced-Binary-Tree.py (100%) rename 1143-Longest-Common-Subsequence.py => python/1143-Longest-Common-Subsequence.py (100%) rename 115-Distinct-Subsequences.py => python/115-Distinct-Subsequences.py (100%) rename 12-Integer-To-Roman.py => python/12-Integer-To-Roman.py (100%) rename 121-Best-Time-To-Buy-and-Sell-Stock.py => python/121-Best-Time-To-Buy-and-Sell-Stock.py (100%) rename 1239-Maximum-Length-of-a-Concatenated-String-with-Unique-Characters.py => python/1239-Maximum-Length-of-a-Concatenated-String-with-Unique-Characters.py (100%) rename 124-Binary-Tree-Maximum-Path-Sum.py => python/124-Binary-Tree-Maximum-Path-Sum.py (100%) rename 125-Valid-Palindrome.py => python/125-Valid-Palindrome.py (100%) rename 127-Word-Ladder.py => python/127-Word-Ladder.py (100%) rename 128-Longest-consecutive-sequence.py => python/128-Longest-consecutive-sequence.py (100%) rename 13-Roman-To-Integer.py => python/13-Roman-To-Integer.py (100%) rename 130-Surrounded-Regions.py => python/130-Surrounded-Regions.py (100%) rename 131-Palindrome-Partitioning.py => python/131-Palindrome-Partitioning.py (100%) rename 133-Clone-Graph.py => python/133-Clone-Graph.py (100%) rename 134-Gas-Station.py => python/134-Gas-Station.py (100%) rename 136-Single-Number.py => python/136-Single-Number.py (100%) rename 138-Copy-List-With-Random-Pointer.py => python/138-Copy-List-With-Random-Pointer.py (100%) rename 139-Word-Break.py => python/139-Word-Break.py (100%) rename 141-Linked-List-Cycle.py => python/141-Linked-List-Cycle.py (100%) rename 143-Reorder-List.py => python/143-Reorder-List.py (100%) rename 1448-Count-Good-Nodes-in-Binary-Tree.py => python/1448-Count-Good-Nodes-in-Binary-Tree.py (100%) rename 146-LRU-Cache.py => python/146-LRU-Cache.py (100%) rename 15-3Sum.py => python/15-3Sum.py (100%) rename 150-Evaluate-Reverse-Polish-Notation.py => python/150-Evaluate-Reverse-Polish-Notation.py (100%) rename 152-Maximum-Product-Subarray.py => python/152-Maximum-Product-Subarray.py (100%) rename 153-Find-Minimum-in-Rotated-Sorted-Array.py => python/153-Find-Minimum-in-Rotated-Sorted-Array.py (100%) rename 155-Min-Stack.py => python/155-Min-Stack.py (100%) rename 1584-Min-Cost-to-Connect-all-Points.py => python/1584-Min-Cost-to-Connect-all-Points.py (100%) rename 160-Intersection-of-Two-Linked-Lists.py => python/160-Intersection-of-Two-Linked-Lists.py (100%) rename 167-Two-Sum-II.py => python/167-Two-Sum-II.py (100%) rename 17-Letter-Combinations-of-a-Phone-Number.py => python/17-Letter-Combinations-of-a-Phone-Number.py (100%) rename 1851-Minimum-Interval-to-Include-Each-Query.py => python/1851-Minimum-Interval-to-Include-Each-Query.py (100%) rename 1899-Merge-Triplets-to-Form-Target-Triplet.py => python/1899-Merge-Triplets-to-Form-Target-Triplet.py (100%) rename 19-Remove-Nth-node-from-end-of-List.py => python/19-Remove-Nth-node-from-end-of-List.py (100%) rename 190-Reverse-Bits.py => python/190-Reverse-Bits.py (100%) rename 1905-Count-Sub-Islands.py => python/1905-Count-Sub-Islands.py (100%) rename 191-Number-of-1-Bits.py => python/191-Number-of-1-Bits.py (100%) rename 198-House-Robber.py => python/198-House-Robber.py (100%) rename 199-Binary-Tree-Right-Side-View.py => python/199-Binary-Tree-Right-Side-View.py (100%) rename 2-Add-Two-Numbers.py => python/2-Add-Two-Numbers.py (100%) rename 20-Valid-Parentheses.py => python/20-Valid-Parentheses.py (100%) rename 200-Number-of-Islands.py => python/200-Number-of-Islands.py (100%) rename 2013-Detect-Squares.py => python/2013-Detect-Squares.py (100%) rename 202-Happy-Number.py => python/202-Happy-Number.py (100%) rename 206-Reverse-Linked-List.py => python/206-Reverse-Linked-List.py (100%) rename 207-Course-Schedule.py => python/207-Course-Schedule.py (100%) rename 208-Implement-Trie.py => python/208-Implement-Trie.py (100%) rename 21-Merge-Two-Sorted-Lists.py => python/21-Merge-Two-Sorted-Lists.py (100%) rename 210-Course-Schedule-II.py => python/210-Course-Schedule-II.py (100%) rename 211-Design-Add-and-Search-Words-Data-Structure.py => python/211-Design-Add-and-Search-Words-Data-Structure.py (100%) rename 212-Word-Search-II.py => python/212-Word-Search-II.py (100%) rename 213-House-Robber-II.py => python/213-House-Robber-II.py (100%) rename 215-Kth-Largest-Element-in-an-Array.py => python/215-Kth-Largest-Element-in-an-Array.py (100%) rename 217-Contains-Duplicate.py => python/217-Contains-Duplicate.py (100%) rename 22-Generate-Parentheses.py => python/22-Generate-Parentheses.py (100%) rename 221-Maximal-Square.py => python/221-Maximal-Square.py (100%) rename 226-Invert-Binary-Tree.py => python/226-Invert-Binary-Tree.py (100%) rename 23-Merge-K-Sorted-Lists.py => python/23-Merge-K-Sorted-Lists.py (100%) rename 230-Kth-Smallest-Element-in-a-BST.py => python/230-Kth-Smallest-Element-in-a-BST.py (100%) rename 236-Lowest-Common-Ancestor-of-a-Binary-Tree.py => python/236-Lowest-Common-Ancestor-of-a-Binary-Tree.py (100%) rename 238-Product-of-array-except-self.py => python/238-Product-of-array-except-self.py (100%) rename 239-Sliding-Window-Maximum.py => python/239-Sliding-Window-Maximum.py (100%) rename 24-Swap-Nodes-in-Pairs.py => python/24-Swap-Nodes-in-Pairs.py (100%) rename 242-Valid-Anagrams.py => python/242-Valid-Anagrams.py (100%) rename 25-Reverse-Nodes-in-K-Group.py => python/25-Reverse-Nodes-in-K-Group.py (100%) rename 252-Meeting-Rooms.py => python/252-Meeting-Rooms.py (100%) rename 253-Meeting-Rooms-ii.py => python/253-Meeting-Rooms-ii.py (100%) rename 261-Graph-Valid-Tree.py => python/261-Graph-Valid-Tree.py (100%) rename 268-Missing-Number.py => python/268-Missing-Number.py (100%) rename 271-Encode-and-Decode-Strings.py => python/271-Encode-and-Decode-Strings.py (100%) rename 28-Implement-strStr.py => python/28-Implement-strStr.py (100%) rename 286-Walls-and-Gates.py => python/286-Walls-and-Gates.py (100%) rename 287-Find-The-Duplicate-Number.py => python/287-Find-The-Duplicate-Number.py (100%) rename 295-Find-Median-from-Data-Stream.py => python/295-Find-Median-from-Data-Stream.py (100%) rename 297-Serialize-and-Deserialize-Binary-Tree.py => python/297-Serialize-and-Deserialize-Binary-Tree.py (100%) rename 3-Longest-Substring-Without-Repeating-Characters.py => python/3-Longest-Substring-Without-Repeating-Characters.py (100%) rename 300-Longest-Increasing-Subsequence.py => python/300-Longest-Increasing-Subsequence.py (100%) rename 309-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.py => python/309-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.py (100%) rename 312-Burst-Balloons.py => python/312-Burst-Balloons.py (100%) rename 322-Coin-Change.py => python/322-Coin-Change.py (100%) rename 329-Longest-Increasing-Path-in-a-Matrix.py => python/329-Longest-Increasing-Path-in-a-Matrix.py (100%) rename 33-Search-In-Rotated-Sorted-Array.py => python/33-Search-In-Rotated-Sorted-Array.py (100%) rename 332-Reconstruct-Itinerary.py => python/332-Reconstruct-Itinerary.py (100%) rename 338-Counting-Bits.py => python/338-Counting-Bits.py (100%) rename 34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.py => python/34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.py (100%) rename 347-Top-k-frequent-elements.py => python/347-Top-k-frequent-elements.py (100%) rename 355-Design-Twitter.py => python/355-Design-Twitter.py (100%) rename 36-Valid-Sudoku.py => python/36-Valid-Sudoku.py (100%) rename 371-Sum-of-Two-Integers.py => python/371-Sum-of-Two-Integers.py (100%) rename 377-Combination-Sum-IV.py => python/377-Combination-Sum-IV.py (100%) rename 39-Combination-Sum.py => python/39-Combination-Sum.py (100%) rename 394-decode-string.py => python/394-decode-string.py (100%) rename 4-median-of-two-sorted-arrays.py => python/4-median-of-two-sorted-arrays.py (100%) rename 40-Combination-Sum-II.py => python/40-Combination-Sum-II.py (100%) rename 40-Combinations-Sum-ii.py => python/40-Combinations-Sum-ii.py (100%) rename 410-Split-Array-Largest-Sum.py => python/410-Split-Array-Largest-Sum.py (100%) rename 416-Partition-Equal-Subset-Sum.py => python/416-Partition-Equal-Subset-Sum.py (100%) rename 417-Pacific-Atlantic-Waterflow.py => python/417-Pacific-Atlantic-Waterflow.py (100%) rename 42-Trapping-Rain-Water.py => python/42-Trapping-Rain-Water.py (100%) rename 424-Longest-Repeating-Character-Replacement.py => python/424-Longest-Repeating-Character-Replacement.py (100%) rename 43-Multiply-Strings.py => python/43-Multiply-Strings.py (100%) rename 435-Non-Overlapping-Intervals.py => python/435-Non-Overlapping-Intervals.py (100%) rename 448-Find-all-Numbers-Disappeared-in-an-Array.py => python/448-Find-all-Numbers-Disappeared-in-an-Array.py (100%) rename 45-Jump-Game-II.py => python/45-Jump-Game-II.py (100%) rename 46-Permutations.py => python/46-Permutations.py (100%) rename 463-Island-Perimeter.py => python/463-Island-Perimeter.py (100%) rename 473-Matchsticks-to-Square.py => python/473-Matchsticks-to-Square.py (100%) rename 48-Rotate-Image.py => python/48-Rotate-Image.py (100%) rename 49-Group-Anagrams.py => python/49-Group-Anagrams.py (100%) rename 494-Target-Sum.py => python/494-Target-Sum.py (100%) rename 5-Longest-Palindromic-Substring.py => python/5-Longest-Palindromic-Substring.py (100%) rename 50-Pow(x, n) => python/50-Pow(x, n) (100%) rename 51-N-Queens.py => python/51-N-Queens.py (100%) rename 518-coin-change-2.py => python/518-coin-change-2.py (100%) rename 53-Maximum-Subarray.py => python/53-Maximum-Subarray.py (100%) rename 54-Spiral-Matrix.py => python/54-Spiral-Matrix.py (100%) rename 543-Diameter-of-Binary-Tree.py => python/543-Diameter-of-Binary-Tree.py (100%) rename 55-Jump-Game.py => python/55-Jump-Game.py (100%) rename 56-Merge-Intervals.py => python/56-Merge-Intervals.py (100%) rename 567-Permutation-in-String.py => python/567-Permutation-in-String.py (100%) rename 57-Insert-Interval.py => python/57-Insert-Interval.py (100%) rename 572-Subtree-of-Another-Tree.py => python/572-Subtree-of-Another-Tree.py (100%) rename 617-Merge-Two-Binary-Trees.py => python/617-Merge-Two-Binary-Trees.py (100%) rename 62-Unique-Paths.py => python/62-Unique-Paths.py (100%) rename 621-Task-Scheduler.py => python/621-Task-Scheduler.py (100%) rename 647-Palindromic-Substrings.py => python/647-Palindromic-Substrings.py (100%) rename 658-Find-K-Closest-Elements.py => python/658-Find-K-Closest-Elements.py (100%) rename 66-Plus-One.py => python/66-Plus-One.py (100%) rename 673-Number-of-Longest-Increasing-Subsequence.py => python/673-Number-of-Longest-Increasing-Subsequence.py (100%) rename 678-Valid-Parenthesis-String.py => python/678-Valid-Parenthesis-String.py (100%) rename 684-Redundant-Connection.py => python/684-Redundant-Connection.py (100%) rename 695-Max-Area-of-Island.py => python/695-Max-Area-of-Island.py (100%) rename 7-Reverse-Integer.py => python/7-Reverse-Integer.py (100%) rename 70-Climbing-Stairs.py => python/70-Climbing-Stairs.py (100%) rename 703-Kth-Largest-Element-in-a-Stream.py => python/703-Kth-Largest-Element-in-a-Stream.py (100%) rename 704-Binary-Search.py => python/704-Binary-Search.py (100%) rename 72-Edit-Distance.py => python/72-Edit-Distance.py (100%) rename 724-Find-Pivot-Index.py => python/724-Find-Pivot-Index.py (100%) rename 73-Set-Matrix-Zeroes.py => python/73-Set-Matrix-Zeroes.py (100%) rename 739-Daily-Temperatures.py => python/739-Daily-Temperatures.py (100%) rename 74-Search-a-2D-Matrix.py => python/74-Search-a-2D-Matrix.py (100%) rename 743-Network-Delay-Time.py => python/743-Network-Delay-Time.py (100%) rename 746-Min-Cost-Climbing-Stairs.py => python/746-Min-Cost-Climbing-Stairs.py (100%) rename 752-Open-the-Lock.py => python/752-Open-the-Lock.py (100%) rename 76-Minimum-Window-Substring.py => python/76-Minimum-Window-Substring.py (100%) rename 763-Partition-Labels.py => python/763-Partition-Labels.py (100%) rename 767-Reorganize-String.py => python/767-Reorganize-String.py (100%) rename 778-Swim-in-Rising-Water.py => python/778-Swim-in-Rising-Water.py (100%) rename 78-Subsets.py => python/78-Subsets.py (100%) rename 787-Cheapest-Flights-within-K-stops.py => python/787-Cheapest-Flights-within-K-stops.py (100%) rename 79-Word-Search.py => python/79-Word-Search.py (100%) rename 84-Largest-Rectangle-in-Histogram.py => python/84-Largest-Rectangle-in-Histogram.py (100%) rename 846-Hand-of-Straights.py => python/846-Hand-of-Straights.py (100%) rename 853-Car-Fleet.py => python/853-Car-Fleet.py (100%) rename 875-Koko-Eating-Bananas.py => python/875-Koko-Eating-Bananas.py (100%) rename 90-Subsets-II.py => python/90-Subsets-II.py (100%) rename 909-Snakes-and-Ladders.py => python/909-Snakes-and-Ladders.py (100%) rename 91-Decode-ways.py => python/91-Decode-ways.py (100%) rename 92-Reverse-Linked-List-II.py => python/92-Reverse-Linked-List-II.py (100%) rename 94-Binary-Tree-Inorder-Traversal.py => python/94-Binary-Tree-Inorder-Traversal.py (100%) rename 97-Interleaving-Strings.py => python/97-Interleaving-Strings.py (100%) rename 973-K-Closest-Points-to-Origin.py => python/973-K-Closest-Points-to-Origin.py (100%) rename 98-Validate-Binary-Search-Tree.py => python/98-Validate-Binary-Search-Tree.py (100%) rename 981-Time-Based-Key-Value-Store.py => python/981-Time-Based-Key-Value-Store.py (100%) rename 994-Rotting-Oranges.py => python/994-Rotting-Oranges.py (100%) diff --git a/371-Sum-of-Two-Integers.java b/371-Sum-of-Two-Integers.java deleted file mode 100644 index ff641469f..000000000 --- a/371-Sum-of-Two-Integers.java +++ /dev/null @@ -1,10 +0,0 @@ -class Solution { - public int getSum(int a, int b) { - while (b != 0) { - int tmp = (a & b) << 1; - a = (a ^ b); - b = tmp; - } - return a; - } -} diff --git a/README.md b/README.md index 82c045bf8..1a9c05b2b 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,7 @@ ### Contributing I mostly do solutions in Python, but if you would like to contribute solutions for other common languages like Java, C++ and JavaScript, please feel free to make a pull request! :) + +## Fork + +This is my personal fork in github, where I am mostly adding C# code. diff --git a/1-Two-Sum.py b/python/1-Two-Sum.py similarity index 100% rename from 1-Two-Sum.py rename to python/1-Two-Sum.py diff --git a/10-Regular-Expression-Matching.py b/python/10-Regular-Expression-Matching.py similarity index 100% rename from 10-Regular-Expression-Matching.py rename to python/10-Regular-Expression-Matching.py diff --git a/100-Same-Tree.py b/python/100-Same-Tree.py similarity index 100% rename from 100-Same-Tree.py rename to python/100-Same-Tree.py diff --git a/102-Binary-Tree-Level-Order-Traversal.py b/python/102-Binary-Tree-Level-Order-Traversal.py similarity index 100% rename from 102-Binary-Tree-Level-Order-Traversal.py rename to python/102-Binary-Tree-Level-Order-Traversal.py diff --git a/104-Maximum-Depth-of-Binary-Tree.py b/python/104-Maximum-Depth-of-Binary-Tree.py similarity index 100% rename from 104-Maximum-Depth-of-Binary-Tree.py rename to python/104-Maximum-Depth-of-Binary-Tree.py diff --git a/1046-Last-Stone-Weight.py b/python/1046-Last-Stone-Weight.py similarity index 100% rename from 1046-Last-Stone-Weight.py rename to python/1046-Last-Stone-Weight.py diff --git a/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.py b/python/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.py similarity index 100% rename from 105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.py rename to python/105-Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.py diff --git a/11-Container-With-Most-Water.py b/python/11-Container-With-Most-Water.py similarity index 100% rename from 11-Container-With-Most-Water.py rename to python/11-Container-With-Most-Water.py diff --git a/110-Balanced-Binary-Tree.py b/python/110-Balanced-Binary-Tree.py similarity index 100% rename from 110-Balanced-Binary-Tree.py rename to python/110-Balanced-Binary-Tree.py diff --git a/1143-Longest-Common-Subsequence.py b/python/1143-Longest-Common-Subsequence.py similarity index 100% rename from 1143-Longest-Common-Subsequence.py rename to python/1143-Longest-Common-Subsequence.py diff --git a/115-Distinct-Subsequences.py b/python/115-Distinct-Subsequences.py similarity index 100% rename from 115-Distinct-Subsequences.py rename to python/115-Distinct-Subsequences.py diff --git a/12-Integer-To-Roman.py b/python/12-Integer-To-Roman.py similarity index 100% rename from 12-Integer-To-Roman.py rename to python/12-Integer-To-Roman.py diff --git a/121-Best-Time-To-Buy-and-Sell-Stock.py b/python/121-Best-Time-To-Buy-and-Sell-Stock.py similarity index 100% rename from 121-Best-Time-To-Buy-and-Sell-Stock.py rename to python/121-Best-Time-To-Buy-and-Sell-Stock.py diff --git a/1239-Maximum-Length-of-a-Concatenated-String-with-Unique-Characters.py b/python/1239-Maximum-Length-of-a-Concatenated-String-with-Unique-Characters.py similarity index 100% rename from 1239-Maximum-Length-of-a-Concatenated-String-with-Unique-Characters.py rename to python/1239-Maximum-Length-of-a-Concatenated-String-with-Unique-Characters.py diff --git a/124-Binary-Tree-Maximum-Path-Sum.py b/python/124-Binary-Tree-Maximum-Path-Sum.py similarity index 100% rename from 124-Binary-Tree-Maximum-Path-Sum.py rename to python/124-Binary-Tree-Maximum-Path-Sum.py diff --git a/125-Valid-Palindrome.py b/python/125-Valid-Palindrome.py similarity index 100% rename from 125-Valid-Palindrome.py rename to python/125-Valid-Palindrome.py diff --git a/127-Word-Ladder.py b/python/127-Word-Ladder.py similarity index 100% rename from 127-Word-Ladder.py rename to python/127-Word-Ladder.py diff --git a/128-Longest-consecutive-sequence.py b/python/128-Longest-consecutive-sequence.py similarity index 100% rename from 128-Longest-consecutive-sequence.py rename to python/128-Longest-consecutive-sequence.py diff --git a/13-Roman-To-Integer.py b/python/13-Roman-To-Integer.py similarity index 100% rename from 13-Roman-To-Integer.py rename to python/13-Roman-To-Integer.py diff --git a/130-Surrounded-Regions.py b/python/130-Surrounded-Regions.py similarity index 100% rename from 130-Surrounded-Regions.py rename to python/130-Surrounded-Regions.py diff --git a/131-Palindrome-Partitioning.py b/python/131-Palindrome-Partitioning.py similarity index 100% rename from 131-Palindrome-Partitioning.py rename to python/131-Palindrome-Partitioning.py diff --git a/133-Clone-Graph.py b/python/133-Clone-Graph.py similarity index 100% rename from 133-Clone-Graph.py rename to python/133-Clone-Graph.py diff --git a/134-Gas-Station.py b/python/134-Gas-Station.py similarity index 100% rename from 134-Gas-Station.py rename to python/134-Gas-Station.py diff --git a/136-Single-Number.py b/python/136-Single-Number.py similarity index 100% rename from 136-Single-Number.py rename to python/136-Single-Number.py diff --git a/138-Copy-List-With-Random-Pointer.py b/python/138-Copy-List-With-Random-Pointer.py similarity index 100% rename from 138-Copy-List-With-Random-Pointer.py rename to python/138-Copy-List-With-Random-Pointer.py diff --git a/139-Word-Break.py b/python/139-Word-Break.py similarity index 100% rename from 139-Word-Break.py rename to python/139-Word-Break.py diff --git a/141-Linked-List-Cycle.py b/python/141-Linked-List-Cycle.py similarity index 100% rename from 141-Linked-List-Cycle.py rename to python/141-Linked-List-Cycle.py diff --git a/143-Reorder-List.py b/python/143-Reorder-List.py similarity index 100% rename from 143-Reorder-List.py rename to python/143-Reorder-List.py diff --git a/1448-Count-Good-Nodes-in-Binary-Tree.py b/python/1448-Count-Good-Nodes-in-Binary-Tree.py similarity index 100% rename from 1448-Count-Good-Nodes-in-Binary-Tree.py rename to python/1448-Count-Good-Nodes-in-Binary-Tree.py diff --git a/146-LRU-Cache.py b/python/146-LRU-Cache.py similarity index 100% rename from 146-LRU-Cache.py rename to python/146-LRU-Cache.py diff --git a/15-3Sum.py b/python/15-3Sum.py similarity index 100% rename from 15-3Sum.py rename to python/15-3Sum.py diff --git a/150-Evaluate-Reverse-Polish-Notation.py b/python/150-Evaluate-Reverse-Polish-Notation.py similarity index 100% rename from 150-Evaluate-Reverse-Polish-Notation.py rename to python/150-Evaluate-Reverse-Polish-Notation.py diff --git a/152-Maximum-Product-Subarray.py b/python/152-Maximum-Product-Subarray.py similarity index 100% rename from 152-Maximum-Product-Subarray.py rename to python/152-Maximum-Product-Subarray.py diff --git a/153-Find-Minimum-in-Rotated-Sorted-Array.py b/python/153-Find-Minimum-in-Rotated-Sorted-Array.py similarity index 100% rename from 153-Find-Minimum-in-Rotated-Sorted-Array.py rename to python/153-Find-Minimum-in-Rotated-Sorted-Array.py diff --git a/155-Min-Stack.py b/python/155-Min-Stack.py similarity index 100% rename from 155-Min-Stack.py rename to python/155-Min-Stack.py diff --git a/1584-Min-Cost-to-Connect-all-Points.py b/python/1584-Min-Cost-to-Connect-all-Points.py similarity index 100% rename from 1584-Min-Cost-to-Connect-all-Points.py rename to python/1584-Min-Cost-to-Connect-all-Points.py diff --git a/160-Intersection-of-Two-Linked-Lists.py b/python/160-Intersection-of-Two-Linked-Lists.py similarity index 100% rename from 160-Intersection-of-Two-Linked-Lists.py rename to python/160-Intersection-of-Two-Linked-Lists.py diff --git a/167-Two-Sum-II.py b/python/167-Two-Sum-II.py similarity index 100% rename from 167-Two-Sum-II.py rename to python/167-Two-Sum-II.py diff --git a/17-Letter-Combinations-of-a-Phone-Number.py b/python/17-Letter-Combinations-of-a-Phone-Number.py similarity index 100% rename from 17-Letter-Combinations-of-a-Phone-Number.py rename to python/17-Letter-Combinations-of-a-Phone-Number.py diff --git a/1851-Minimum-Interval-to-Include-Each-Query.py b/python/1851-Minimum-Interval-to-Include-Each-Query.py similarity index 100% rename from 1851-Minimum-Interval-to-Include-Each-Query.py rename to python/1851-Minimum-Interval-to-Include-Each-Query.py diff --git a/1899-Merge-Triplets-to-Form-Target-Triplet.py b/python/1899-Merge-Triplets-to-Form-Target-Triplet.py similarity index 100% rename from 1899-Merge-Triplets-to-Form-Target-Triplet.py rename to python/1899-Merge-Triplets-to-Form-Target-Triplet.py diff --git a/19-Remove-Nth-node-from-end-of-List.py b/python/19-Remove-Nth-node-from-end-of-List.py similarity index 100% rename from 19-Remove-Nth-node-from-end-of-List.py rename to python/19-Remove-Nth-node-from-end-of-List.py diff --git a/190-Reverse-Bits.py b/python/190-Reverse-Bits.py similarity index 100% rename from 190-Reverse-Bits.py rename to python/190-Reverse-Bits.py diff --git a/1905-Count-Sub-Islands.py b/python/1905-Count-Sub-Islands.py similarity index 100% rename from 1905-Count-Sub-Islands.py rename to python/1905-Count-Sub-Islands.py diff --git a/191-Number-of-1-Bits.py b/python/191-Number-of-1-Bits.py similarity index 100% rename from 191-Number-of-1-Bits.py rename to python/191-Number-of-1-Bits.py diff --git a/198-House-Robber.py b/python/198-House-Robber.py similarity index 100% rename from 198-House-Robber.py rename to python/198-House-Robber.py diff --git a/199-Binary-Tree-Right-Side-View.py b/python/199-Binary-Tree-Right-Side-View.py similarity index 100% rename from 199-Binary-Tree-Right-Side-View.py rename to python/199-Binary-Tree-Right-Side-View.py diff --git a/2-Add-Two-Numbers.py b/python/2-Add-Two-Numbers.py similarity index 100% rename from 2-Add-Two-Numbers.py rename to python/2-Add-Two-Numbers.py diff --git a/20-Valid-Parentheses.py b/python/20-Valid-Parentheses.py similarity index 100% rename from 20-Valid-Parentheses.py rename to python/20-Valid-Parentheses.py diff --git a/200-Number-of-Islands.py b/python/200-Number-of-Islands.py similarity index 100% rename from 200-Number-of-Islands.py rename to python/200-Number-of-Islands.py diff --git a/2013-Detect-Squares.py b/python/2013-Detect-Squares.py similarity index 100% rename from 2013-Detect-Squares.py rename to python/2013-Detect-Squares.py diff --git a/202-Happy-Number.py b/python/202-Happy-Number.py similarity index 100% rename from 202-Happy-Number.py rename to python/202-Happy-Number.py diff --git a/206-Reverse-Linked-List.py b/python/206-Reverse-Linked-List.py similarity index 100% rename from 206-Reverse-Linked-List.py rename to python/206-Reverse-Linked-List.py diff --git a/207-Course-Schedule.py b/python/207-Course-Schedule.py similarity index 100% rename from 207-Course-Schedule.py rename to python/207-Course-Schedule.py diff --git a/208-Implement-Trie.py b/python/208-Implement-Trie.py similarity index 100% rename from 208-Implement-Trie.py rename to python/208-Implement-Trie.py diff --git a/21-Merge-Two-Sorted-Lists.py b/python/21-Merge-Two-Sorted-Lists.py similarity index 100% rename from 21-Merge-Two-Sorted-Lists.py rename to python/21-Merge-Two-Sorted-Lists.py diff --git a/210-Course-Schedule-II.py b/python/210-Course-Schedule-II.py similarity index 100% rename from 210-Course-Schedule-II.py rename to python/210-Course-Schedule-II.py diff --git a/211-Design-Add-and-Search-Words-Data-Structure.py b/python/211-Design-Add-and-Search-Words-Data-Structure.py similarity index 100% rename from 211-Design-Add-and-Search-Words-Data-Structure.py rename to python/211-Design-Add-and-Search-Words-Data-Structure.py diff --git a/212-Word-Search-II.py b/python/212-Word-Search-II.py similarity index 100% rename from 212-Word-Search-II.py rename to python/212-Word-Search-II.py diff --git a/213-House-Robber-II.py b/python/213-House-Robber-II.py similarity index 100% rename from 213-House-Robber-II.py rename to python/213-House-Robber-II.py diff --git a/215-Kth-Largest-Element-in-an-Array.py b/python/215-Kth-Largest-Element-in-an-Array.py similarity index 100% rename from 215-Kth-Largest-Element-in-an-Array.py rename to python/215-Kth-Largest-Element-in-an-Array.py diff --git a/217-Contains-Duplicate.py b/python/217-Contains-Duplicate.py similarity index 100% rename from 217-Contains-Duplicate.py rename to python/217-Contains-Duplicate.py diff --git a/22-Generate-Parentheses.py b/python/22-Generate-Parentheses.py similarity index 100% rename from 22-Generate-Parentheses.py rename to python/22-Generate-Parentheses.py diff --git a/221-Maximal-Square.py b/python/221-Maximal-Square.py similarity index 100% rename from 221-Maximal-Square.py rename to python/221-Maximal-Square.py diff --git a/226-Invert-Binary-Tree.py b/python/226-Invert-Binary-Tree.py similarity index 100% rename from 226-Invert-Binary-Tree.py rename to python/226-Invert-Binary-Tree.py diff --git a/23-Merge-K-Sorted-Lists.py b/python/23-Merge-K-Sorted-Lists.py similarity index 100% rename from 23-Merge-K-Sorted-Lists.py rename to python/23-Merge-K-Sorted-Lists.py diff --git a/230-Kth-Smallest-Element-in-a-BST.py b/python/230-Kth-Smallest-Element-in-a-BST.py similarity index 100% rename from 230-Kth-Smallest-Element-in-a-BST.py rename to python/230-Kth-Smallest-Element-in-a-BST.py diff --git a/236-Lowest-Common-Ancestor-of-a-Binary-Tree.py b/python/236-Lowest-Common-Ancestor-of-a-Binary-Tree.py similarity index 100% rename from 236-Lowest-Common-Ancestor-of-a-Binary-Tree.py rename to python/236-Lowest-Common-Ancestor-of-a-Binary-Tree.py diff --git a/238-Product-of-array-except-self.py b/python/238-Product-of-array-except-self.py similarity index 100% rename from 238-Product-of-array-except-self.py rename to python/238-Product-of-array-except-self.py diff --git a/239-Sliding-Window-Maximum.py b/python/239-Sliding-Window-Maximum.py similarity index 100% rename from 239-Sliding-Window-Maximum.py rename to python/239-Sliding-Window-Maximum.py diff --git a/24-Swap-Nodes-in-Pairs.py b/python/24-Swap-Nodes-in-Pairs.py similarity index 100% rename from 24-Swap-Nodes-in-Pairs.py rename to python/24-Swap-Nodes-in-Pairs.py diff --git a/242-Valid-Anagrams.py b/python/242-Valid-Anagrams.py similarity index 100% rename from 242-Valid-Anagrams.py rename to python/242-Valid-Anagrams.py diff --git a/25-Reverse-Nodes-in-K-Group.py b/python/25-Reverse-Nodes-in-K-Group.py similarity index 100% rename from 25-Reverse-Nodes-in-K-Group.py rename to python/25-Reverse-Nodes-in-K-Group.py diff --git a/252-Meeting-Rooms.py b/python/252-Meeting-Rooms.py similarity index 100% rename from 252-Meeting-Rooms.py rename to python/252-Meeting-Rooms.py diff --git a/253-Meeting-Rooms-ii.py b/python/253-Meeting-Rooms-ii.py similarity index 100% rename from 253-Meeting-Rooms-ii.py rename to python/253-Meeting-Rooms-ii.py diff --git a/261-Graph-Valid-Tree.py b/python/261-Graph-Valid-Tree.py similarity index 100% rename from 261-Graph-Valid-Tree.py rename to python/261-Graph-Valid-Tree.py diff --git a/268-Missing-Number.py b/python/268-Missing-Number.py similarity index 100% rename from 268-Missing-Number.py rename to python/268-Missing-Number.py diff --git a/271-Encode-and-Decode-Strings.py b/python/271-Encode-and-Decode-Strings.py similarity index 100% rename from 271-Encode-and-Decode-Strings.py rename to python/271-Encode-and-Decode-Strings.py diff --git a/28-Implement-strStr.py b/python/28-Implement-strStr.py similarity index 100% rename from 28-Implement-strStr.py rename to python/28-Implement-strStr.py diff --git a/286-Walls-and-Gates.py b/python/286-Walls-and-Gates.py similarity index 100% rename from 286-Walls-and-Gates.py rename to python/286-Walls-and-Gates.py diff --git a/287-Find-The-Duplicate-Number.py b/python/287-Find-The-Duplicate-Number.py similarity index 100% rename from 287-Find-The-Duplicate-Number.py rename to python/287-Find-The-Duplicate-Number.py diff --git a/295-Find-Median-from-Data-Stream.py b/python/295-Find-Median-from-Data-Stream.py similarity index 100% rename from 295-Find-Median-from-Data-Stream.py rename to python/295-Find-Median-from-Data-Stream.py diff --git a/297-Serialize-and-Deserialize-Binary-Tree.py b/python/297-Serialize-and-Deserialize-Binary-Tree.py similarity index 100% rename from 297-Serialize-and-Deserialize-Binary-Tree.py rename to python/297-Serialize-and-Deserialize-Binary-Tree.py diff --git a/3-Longest-Substring-Without-Repeating-Characters.py b/python/3-Longest-Substring-Without-Repeating-Characters.py similarity index 100% rename from 3-Longest-Substring-Without-Repeating-Characters.py rename to python/3-Longest-Substring-Without-Repeating-Characters.py diff --git a/300-Longest-Increasing-Subsequence.py b/python/300-Longest-Increasing-Subsequence.py similarity index 100% rename from 300-Longest-Increasing-Subsequence.py rename to python/300-Longest-Increasing-Subsequence.py diff --git a/309-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.py b/python/309-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.py similarity index 100% rename from 309-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.py rename to python/309-Best-Time-To-Buy-and-Sell-Stock-With-Cooldown.py diff --git a/312-Burst-Balloons.py b/python/312-Burst-Balloons.py similarity index 100% rename from 312-Burst-Balloons.py rename to python/312-Burst-Balloons.py diff --git a/322-Coin-Change.py b/python/322-Coin-Change.py similarity index 100% rename from 322-Coin-Change.py rename to python/322-Coin-Change.py diff --git a/329-Longest-Increasing-Path-in-a-Matrix.py b/python/329-Longest-Increasing-Path-in-a-Matrix.py similarity index 100% rename from 329-Longest-Increasing-Path-in-a-Matrix.py rename to python/329-Longest-Increasing-Path-in-a-Matrix.py diff --git a/33-Search-In-Rotated-Sorted-Array.py b/python/33-Search-In-Rotated-Sorted-Array.py similarity index 100% rename from 33-Search-In-Rotated-Sorted-Array.py rename to python/33-Search-In-Rotated-Sorted-Array.py diff --git a/332-Reconstruct-Itinerary.py b/python/332-Reconstruct-Itinerary.py similarity index 100% rename from 332-Reconstruct-Itinerary.py rename to python/332-Reconstruct-Itinerary.py diff --git a/338-Counting-Bits.py b/python/338-Counting-Bits.py similarity index 100% rename from 338-Counting-Bits.py rename to python/338-Counting-Bits.py diff --git a/34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.py b/python/34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.py similarity index 100% rename from 34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.py rename to python/34-Find-First-and-Last-Position-of-Element-in-Sorted-Array.py diff --git a/347-Top-k-frequent-elements.py b/python/347-Top-k-frequent-elements.py similarity index 100% rename from 347-Top-k-frequent-elements.py rename to python/347-Top-k-frequent-elements.py diff --git a/355-Design-Twitter.py b/python/355-Design-Twitter.py similarity index 100% rename from 355-Design-Twitter.py rename to python/355-Design-Twitter.py diff --git a/36-Valid-Sudoku.py b/python/36-Valid-Sudoku.py similarity index 100% rename from 36-Valid-Sudoku.py rename to python/36-Valid-Sudoku.py diff --git a/371-Sum-of-Two-Integers.py b/python/371-Sum-of-Two-Integers.py similarity index 100% rename from 371-Sum-of-Two-Integers.py rename to python/371-Sum-of-Two-Integers.py diff --git a/377-Combination-Sum-IV.py b/python/377-Combination-Sum-IV.py similarity index 100% rename from 377-Combination-Sum-IV.py rename to python/377-Combination-Sum-IV.py diff --git a/39-Combination-Sum.py b/python/39-Combination-Sum.py similarity index 100% rename from 39-Combination-Sum.py rename to python/39-Combination-Sum.py diff --git a/394-decode-string.py b/python/394-decode-string.py similarity index 100% rename from 394-decode-string.py rename to python/394-decode-string.py diff --git a/4-median-of-two-sorted-arrays.py b/python/4-median-of-two-sorted-arrays.py similarity index 100% rename from 4-median-of-two-sorted-arrays.py rename to python/4-median-of-two-sorted-arrays.py diff --git a/40-Combination-Sum-II.py b/python/40-Combination-Sum-II.py similarity index 100% rename from 40-Combination-Sum-II.py rename to python/40-Combination-Sum-II.py diff --git a/40-Combinations-Sum-ii.py b/python/40-Combinations-Sum-ii.py similarity index 100% rename from 40-Combinations-Sum-ii.py rename to python/40-Combinations-Sum-ii.py diff --git a/410-Split-Array-Largest-Sum.py b/python/410-Split-Array-Largest-Sum.py similarity index 100% rename from 410-Split-Array-Largest-Sum.py rename to python/410-Split-Array-Largest-Sum.py diff --git a/416-Partition-Equal-Subset-Sum.py b/python/416-Partition-Equal-Subset-Sum.py similarity index 100% rename from 416-Partition-Equal-Subset-Sum.py rename to python/416-Partition-Equal-Subset-Sum.py diff --git a/417-Pacific-Atlantic-Waterflow.py b/python/417-Pacific-Atlantic-Waterflow.py similarity index 100% rename from 417-Pacific-Atlantic-Waterflow.py rename to python/417-Pacific-Atlantic-Waterflow.py diff --git a/42-Trapping-Rain-Water.py b/python/42-Trapping-Rain-Water.py similarity index 100% rename from 42-Trapping-Rain-Water.py rename to python/42-Trapping-Rain-Water.py diff --git a/424-Longest-Repeating-Character-Replacement.py b/python/424-Longest-Repeating-Character-Replacement.py similarity index 100% rename from 424-Longest-Repeating-Character-Replacement.py rename to python/424-Longest-Repeating-Character-Replacement.py diff --git a/43-Multiply-Strings.py b/python/43-Multiply-Strings.py similarity index 100% rename from 43-Multiply-Strings.py rename to python/43-Multiply-Strings.py diff --git a/435-Non-Overlapping-Intervals.py b/python/435-Non-Overlapping-Intervals.py similarity index 100% rename from 435-Non-Overlapping-Intervals.py rename to python/435-Non-Overlapping-Intervals.py diff --git a/448-Find-all-Numbers-Disappeared-in-an-Array.py b/python/448-Find-all-Numbers-Disappeared-in-an-Array.py similarity index 100% rename from 448-Find-all-Numbers-Disappeared-in-an-Array.py rename to python/448-Find-all-Numbers-Disappeared-in-an-Array.py diff --git a/45-Jump-Game-II.py b/python/45-Jump-Game-II.py similarity index 100% rename from 45-Jump-Game-II.py rename to python/45-Jump-Game-II.py diff --git a/46-Permutations.py b/python/46-Permutations.py similarity index 100% rename from 46-Permutations.py rename to python/46-Permutations.py diff --git a/463-Island-Perimeter.py b/python/463-Island-Perimeter.py similarity index 100% rename from 463-Island-Perimeter.py rename to python/463-Island-Perimeter.py diff --git a/473-Matchsticks-to-Square.py b/python/473-Matchsticks-to-Square.py similarity index 100% rename from 473-Matchsticks-to-Square.py rename to python/473-Matchsticks-to-Square.py diff --git a/48-Rotate-Image.py b/python/48-Rotate-Image.py similarity index 100% rename from 48-Rotate-Image.py rename to python/48-Rotate-Image.py diff --git a/49-Group-Anagrams.py b/python/49-Group-Anagrams.py similarity index 100% rename from 49-Group-Anagrams.py rename to python/49-Group-Anagrams.py diff --git a/494-Target-Sum.py b/python/494-Target-Sum.py similarity index 100% rename from 494-Target-Sum.py rename to python/494-Target-Sum.py diff --git a/5-Longest-Palindromic-Substring.py b/python/5-Longest-Palindromic-Substring.py similarity index 100% rename from 5-Longest-Palindromic-Substring.py rename to python/5-Longest-Palindromic-Substring.py diff --git a/50-Pow(x, n) b/python/50-Pow(x, n) similarity index 100% rename from 50-Pow(x, n) rename to python/50-Pow(x, n) diff --git a/51-N-Queens.py b/python/51-N-Queens.py similarity index 100% rename from 51-N-Queens.py rename to python/51-N-Queens.py diff --git a/518-coin-change-2.py b/python/518-coin-change-2.py similarity index 100% rename from 518-coin-change-2.py rename to python/518-coin-change-2.py diff --git a/53-Maximum-Subarray.py b/python/53-Maximum-Subarray.py similarity index 100% rename from 53-Maximum-Subarray.py rename to python/53-Maximum-Subarray.py diff --git a/54-Spiral-Matrix.py b/python/54-Spiral-Matrix.py similarity index 100% rename from 54-Spiral-Matrix.py rename to python/54-Spiral-Matrix.py diff --git a/543-Diameter-of-Binary-Tree.py b/python/543-Diameter-of-Binary-Tree.py similarity index 100% rename from 543-Diameter-of-Binary-Tree.py rename to python/543-Diameter-of-Binary-Tree.py diff --git a/55-Jump-Game.py b/python/55-Jump-Game.py similarity index 100% rename from 55-Jump-Game.py rename to python/55-Jump-Game.py diff --git a/56-Merge-Intervals.py b/python/56-Merge-Intervals.py similarity index 100% rename from 56-Merge-Intervals.py rename to python/56-Merge-Intervals.py diff --git a/567-Permutation-in-String.py b/python/567-Permutation-in-String.py similarity index 100% rename from 567-Permutation-in-String.py rename to python/567-Permutation-in-String.py diff --git a/57-Insert-Interval.py b/python/57-Insert-Interval.py similarity index 100% rename from 57-Insert-Interval.py rename to python/57-Insert-Interval.py diff --git a/572-Subtree-of-Another-Tree.py b/python/572-Subtree-of-Another-Tree.py similarity index 100% rename from 572-Subtree-of-Another-Tree.py rename to python/572-Subtree-of-Another-Tree.py diff --git a/617-Merge-Two-Binary-Trees.py b/python/617-Merge-Two-Binary-Trees.py similarity index 100% rename from 617-Merge-Two-Binary-Trees.py rename to python/617-Merge-Two-Binary-Trees.py diff --git a/62-Unique-Paths.py b/python/62-Unique-Paths.py similarity index 100% rename from 62-Unique-Paths.py rename to python/62-Unique-Paths.py diff --git a/621-Task-Scheduler.py b/python/621-Task-Scheduler.py similarity index 100% rename from 621-Task-Scheduler.py rename to python/621-Task-Scheduler.py diff --git a/647-Palindromic-Substrings.py b/python/647-Palindromic-Substrings.py similarity index 100% rename from 647-Palindromic-Substrings.py rename to python/647-Palindromic-Substrings.py diff --git a/658-Find-K-Closest-Elements.py b/python/658-Find-K-Closest-Elements.py similarity index 100% rename from 658-Find-K-Closest-Elements.py rename to python/658-Find-K-Closest-Elements.py diff --git a/66-Plus-One.py b/python/66-Plus-One.py similarity index 100% rename from 66-Plus-One.py rename to python/66-Plus-One.py diff --git a/673-Number-of-Longest-Increasing-Subsequence.py b/python/673-Number-of-Longest-Increasing-Subsequence.py similarity index 100% rename from 673-Number-of-Longest-Increasing-Subsequence.py rename to python/673-Number-of-Longest-Increasing-Subsequence.py diff --git a/678-Valid-Parenthesis-String.py b/python/678-Valid-Parenthesis-String.py similarity index 100% rename from 678-Valid-Parenthesis-String.py rename to python/678-Valid-Parenthesis-String.py diff --git a/684-Redundant-Connection.py b/python/684-Redundant-Connection.py similarity index 100% rename from 684-Redundant-Connection.py rename to python/684-Redundant-Connection.py diff --git a/695-Max-Area-of-Island.py b/python/695-Max-Area-of-Island.py similarity index 100% rename from 695-Max-Area-of-Island.py rename to python/695-Max-Area-of-Island.py diff --git a/7-Reverse-Integer.py b/python/7-Reverse-Integer.py similarity index 100% rename from 7-Reverse-Integer.py rename to python/7-Reverse-Integer.py diff --git a/70-Climbing-Stairs.py b/python/70-Climbing-Stairs.py similarity index 100% rename from 70-Climbing-Stairs.py rename to python/70-Climbing-Stairs.py diff --git a/703-Kth-Largest-Element-in-a-Stream.py b/python/703-Kth-Largest-Element-in-a-Stream.py similarity index 100% rename from 703-Kth-Largest-Element-in-a-Stream.py rename to python/703-Kth-Largest-Element-in-a-Stream.py diff --git a/704-Binary-Search.py b/python/704-Binary-Search.py similarity index 100% rename from 704-Binary-Search.py rename to python/704-Binary-Search.py diff --git a/72-Edit-Distance.py b/python/72-Edit-Distance.py similarity index 100% rename from 72-Edit-Distance.py rename to python/72-Edit-Distance.py diff --git a/724-Find-Pivot-Index.py b/python/724-Find-Pivot-Index.py similarity index 100% rename from 724-Find-Pivot-Index.py rename to python/724-Find-Pivot-Index.py diff --git a/73-Set-Matrix-Zeroes.py b/python/73-Set-Matrix-Zeroes.py similarity index 100% rename from 73-Set-Matrix-Zeroes.py rename to python/73-Set-Matrix-Zeroes.py diff --git a/739-Daily-Temperatures.py b/python/739-Daily-Temperatures.py similarity index 100% rename from 739-Daily-Temperatures.py rename to python/739-Daily-Temperatures.py diff --git a/74-Search-a-2D-Matrix.py b/python/74-Search-a-2D-Matrix.py similarity index 100% rename from 74-Search-a-2D-Matrix.py rename to python/74-Search-a-2D-Matrix.py diff --git a/743-Network-Delay-Time.py b/python/743-Network-Delay-Time.py similarity index 100% rename from 743-Network-Delay-Time.py rename to python/743-Network-Delay-Time.py diff --git a/746-Min-Cost-Climbing-Stairs.py b/python/746-Min-Cost-Climbing-Stairs.py similarity index 100% rename from 746-Min-Cost-Climbing-Stairs.py rename to python/746-Min-Cost-Climbing-Stairs.py diff --git a/752-Open-the-Lock.py b/python/752-Open-the-Lock.py similarity index 100% rename from 752-Open-the-Lock.py rename to python/752-Open-the-Lock.py diff --git a/76-Minimum-Window-Substring.py b/python/76-Minimum-Window-Substring.py similarity index 100% rename from 76-Minimum-Window-Substring.py rename to python/76-Minimum-Window-Substring.py diff --git a/763-Partition-Labels.py b/python/763-Partition-Labels.py similarity index 100% rename from 763-Partition-Labels.py rename to python/763-Partition-Labels.py diff --git a/767-Reorganize-String.py b/python/767-Reorganize-String.py similarity index 100% rename from 767-Reorganize-String.py rename to python/767-Reorganize-String.py diff --git a/778-Swim-in-Rising-Water.py b/python/778-Swim-in-Rising-Water.py similarity index 100% rename from 778-Swim-in-Rising-Water.py rename to python/778-Swim-in-Rising-Water.py diff --git a/78-Subsets.py b/python/78-Subsets.py similarity index 100% rename from 78-Subsets.py rename to python/78-Subsets.py diff --git a/787-Cheapest-Flights-within-K-stops.py b/python/787-Cheapest-Flights-within-K-stops.py similarity index 100% rename from 787-Cheapest-Flights-within-K-stops.py rename to python/787-Cheapest-Flights-within-K-stops.py diff --git a/79-Word-Search.py b/python/79-Word-Search.py similarity index 100% rename from 79-Word-Search.py rename to python/79-Word-Search.py diff --git a/84-Largest-Rectangle-in-Histogram.py b/python/84-Largest-Rectangle-in-Histogram.py similarity index 100% rename from 84-Largest-Rectangle-in-Histogram.py rename to python/84-Largest-Rectangle-in-Histogram.py diff --git a/846-Hand-of-Straights.py b/python/846-Hand-of-Straights.py similarity index 100% rename from 846-Hand-of-Straights.py rename to python/846-Hand-of-Straights.py diff --git a/853-Car-Fleet.py b/python/853-Car-Fleet.py similarity index 100% rename from 853-Car-Fleet.py rename to python/853-Car-Fleet.py diff --git a/875-Koko-Eating-Bananas.py b/python/875-Koko-Eating-Bananas.py similarity index 100% rename from 875-Koko-Eating-Bananas.py rename to python/875-Koko-Eating-Bananas.py diff --git a/90-Subsets-II.py b/python/90-Subsets-II.py similarity index 100% rename from 90-Subsets-II.py rename to python/90-Subsets-II.py diff --git a/909-Snakes-and-Ladders.py b/python/909-Snakes-and-Ladders.py similarity index 100% rename from 909-Snakes-and-Ladders.py rename to python/909-Snakes-and-Ladders.py diff --git a/91-Decode-ways.py b/python/91-Decode-ways.py similarity index 100% rename from 91-Decode-ways.py rename to python/91-Decode-ways.py diff --git a/92-Reverse-Linked-List-II.py b/python/92-Reverse-Linked-List-II.py similarity index 100% rename from 92-Reverse-Linked-List-II.py rename to python/92-Reverse-Linked-List-II.py diff --git a/94-Binary-Tree-Inorder-Traversal.py b/python/94-Binary-Tree-Inorder-Traversal.py similarity index 100% rename from 94-Binary-Tree-Inorder-Traversal.py rename to python/94-Binary-Tree-Inorder-Traversal.py diff --git a/97-Interleaving-Strings.py b/python/97-Interleaving-Strings.py similarity index 100% rename from 97-Interleaving-Strings.py rename to python/97-Interleaving-Strings.py diff --git a/973-K-Closest-Points-to-Origin.py b/python/973-K-Closest-Points-to-Origin.py similarity index 100% rename from 973-K-Closest-Points-to-Origin.py rename to python/973-K-Closest-Points-to-Origin.py diff --git a/98-Validate-Binary-Search-Tree.py b/python/98-Validate-Binary-Search-Tree.py similarity index 100% rename from 98-Validate-Binary-Search-Tree.py rename to python/98-Validate-Binary-Search-Tree.py diff --git a/981-Time-Based-Key-Value-Store.py b/python/981-Time-Based-Key-Value-Store.py similarity index 100% rename from 981-Time-Based-Key-Value-Store.py rename to python/981-Time-Based-Key-Value-Store.py diff --git a/994-Rotting-Oranges.py b/python/994-Rotting-Oranges.py similarity index 100% rename from 994-Rotting-Oranges.py rename to python/994-Rotting-Oranges.py From 352309793c6930b21f55be408fac8b8b19382287 Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Mon, 2 May 2022 23:47:58 +0200 Subject: [PATCH 02/94] CHORE, FEAT : adds proj for first set of exercises, together with test proj. Creates gitignore --- .gitignore | 133 ++++++++++++++++++ .vscode/launch.json | 26 ++++ .vscode/settings.json | 3 + .vscode/tasks.json | 41 ++++++ csharp/ArraysAndHashing/build.proj | 5 + .../N1-L217-ContainsDuplicate/Solution.cs | 10 ++ .../main/N1-L217-ContainsDuplicate/readme.md | 24 ++++ csharp/ArraysAndHashing/main/Program.cs | 2 + csharp/ArraysAndHashing/main/main.csproj | 10 ++ .../N1-L217-ContainsDuplicate_Test.cs | 27 ++++ .../testCases/testCases.csproj | 19 +++ 11 files changed, 300 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 csharp/ArraysAndHashing/build.proj create mode 100644 csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/Solution.cs create mode 100644 csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md create mode 100644 csharp/ArraysAndHashing/main/Program.cs create mode 100644 csharp/ArraysAndHashing/main/main.csproj create mode 100644 csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs create mode 100644 csharp/ArraysAndHashing/testCases/testCases.csproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..8c7f0e804 --- /dev/null +++ b/.gitignore @@ -0,0 +1,133 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.svclog +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml +*.azurePubxml + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +packages/ +## TODO: If the tool you use requires repositories.config, also uncomment the next line +!packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +![Ss]tyle[Cc]op.targets +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml + +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store + +_NCrunch* diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..3f8e0a1a9 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + "version": "0.2.0", + "configurations": [ + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/csharp/ArraysAndHashing/bin/Debug/net6.0/ArraysAndHashing.dll", + "args": [], + "cwd": "${workspaceFolder}/csharp/ArraysAndHashing", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..775531661 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "dotnet-test-explorer.testProjectPath": "**/**/testCases.csproj" +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..105dc04aa --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,41 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/csharp/ArraysAndHashing/build.proj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/csharp/ArraysAndHashing/ArraysAndHashing.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "--project", + "${workspaceFolder}/csharp/ArraysAndHashing/ArraysAndHashing.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/csharp/ArraysAndHashing/build.proj b/csharp/ArraysAndHashing/build.proj new file mode 100644 index 000000000..f63ef53ad --- /dev/null +++ b/csharp/ArraysAndHashing/build.proj @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/Solution.cs b/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/Solution.cs new file mode 100644 index 000000000..258b09f25 --- /dev/null +++ b/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/Solution.cs @@ -0,0 +1,10 @@ +namespace ArrayAndHashing.Main.ContainsDuplicate +{ + public class Solution + { + public bool ContainsDuplicate(int[] nums) + { + return false; + } + } +} diff --git a/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md b/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md new file mode 100644 index 000000000..0f69937a4 --- /dev/null +++ b/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md @@ -0,0 +1,24 @@ +## 217. Contains duplicate + +Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. + +## Example 1: + +Input: nums = [1,2,3,1] +Output: true + +## Example 2: + +Input: nums = [1,2,3,4] +Output: false + +## Example 3: + +Input: nums = [1,1,1,3,3,4,3,2,4,2] +Output: true + +## Constraints: + + 1 <= nums.length <= 105 + -109 <= nums[i] <= 109 + diff --git a/csharp/ArraysAndHashing/main/Program.cs b/csharp/ArraysAndHashing/main/Program.cs new file mode 100644 index 000000000..83fa4f4d5 --- /dev/null +++ b/csharp/ArraysAndHashing/main/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/csharp/ArraysAndHashing/main/main.csproj b/csharp/ArraysAndHashing/main/main.csproj new file mode 100644 index 000000000..40c60dd4c --- /dev/null +++ b/csharp/ArraysAndHashing/main/main.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs b/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs new file mode 100644 index 000000000..7cb892549 --- /dev/null +++ b/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using ArrayAndHashing.Main.ContainsDuplicate; +using FluentAssertions; + +namespace testCases; + +public class Tests +{ + [SetUp] + public void Setup() + { + } + + [Test] + public void TestCase_1() + { + // Arrange + int[] input = {1, 2, 3, 1}; + + // Act + Solution solution = new Solution(); + bool testResult = solution.ContainsDuplicate(input); + + // Assert + testResult.Should().Be(true); + } +} \ No newline at end of file diff --git a/csharp/ArraysAndHashing/testCases/testCases.csproj b/csharp/ArraysAndHashing/testCases/testCases.csproj new file mode 100644 index 000000000..04bdaa75b --- /dev/null +++ b/csharp/ArraysAndHashing/testCases/testCases.csproj @@ -0,0 +1,19 @@ + + + + net6.0 + enable + + false + + + + + + + + + + + + From 77d1240acdce5549b571a5b3defaeab3ead0e501 Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Tue, 3 May 2022 00:05:48 +0200 Subject: [PATCH 03/94] FEAT : solving N1-L217, passing all tests --- .../N1-L217-ContainsDuplicate/Solution.cs | 8 +++ .../N1-L217-ContainsDuplicate_Test.cs | 56 +++++++++++++------ 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/Solution.cs b/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/Solution.cs index 258b09f25..3cb20ccd2 100644 --- a/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/Solution.cs +++ b/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/Solution.cs @@ -4,6 +4,14 @@ public class Solution { public bool ContainsDuplicate(int[] nums) { + HashSet seenNums = new(); + foreach (var item in nums) + { + if (seenNums.Contains(item)) + return true; + seenNums.Add(item); + } + return false; } } diff --git a/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs b/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs index 7cb892549..aed4244cb 100644 --- a/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs +++ b/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs @@ -6,22 +6,42 @@ namespace testCases; public class Tests { - [SetUp] - public void Setup() - { - } - - [Test] - public void TestCase_1() - { - // Arrange - int[] input = {1, 2, 3, 1}; - - // Act - Solution solution = new Solution(); - bool testResult = solution.ContainsDuplicate(input); - - // Assert - testResult.Should().Be(true); - } + [SetUp] + public void Setup() + { + + } + + [Test] + public void TestCase_1() + { + // Arrange + int[] input = { 1, 2, 3, 1 }; + + // Act + Solution solution = new Solution(); + bool testResult = solution.ContainsDuplicate(input); + + // Assert + testResult.Should().Be(true); + } + + [Test] + public void TestCase_2() + { + int[] input = { 1, 2, 3, 4 }; + + // Act + Solution solution = new Solution(); + bool testResult = solution.ContainsDuplicate(input); + + // Assert + testResult.Should().Be(false); + } + + [Test] + public void TestCase_3() + { + int[] input = {1, 1, 1, 3, 3, 4, 3, 2, 4, 2 }; + } } \ No newline at end of file From de3d6dbc9b9929ce61cc8019644b2d0ab5dff1e1 Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Tue, 3 May 2022 21:57:19 +0200 Subject: [PATCH 04/94] CHORE : fail test for L2-N242 --- .../main/N1-L217-ContainsDuplicate/readme.md | 2 +- .../main/N2-L242-ValidAnagram/Solution.cs | 10 ++++++++ .../main/N2-L242-ValidAnagram/readme.md | 22 ++++++++++++++++ .../N1-L217-ContainsDuplicate_Test.cs | 15 ++++++----- .../testCases/N2-L242-ValidAnagram_Test.cs | 25 +++++++++++++++++++ 5 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs create mode 100644 csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/readme.md create mode 100644 csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs diff --git a/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md b/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md index 0f69937a4..165aef5f3 100644 --- a/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md +++ b/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md @@ -1,4 +1,4 @@ -## 217. Contains duplicate +# 217. Contains duplicate Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. diff --git a/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs b/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs new file mode 100644 index 000000000..f1e2379a3 --- /dev/null +++ b/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs @@ -0,0 +1,10 @@ +namespace ArrayAndHashing.Main.Validanagram +{ + public class Solution + { + public bool IsAnagram(string s, string t) + { + return false; + } + } +} \ No newline at end of file diff --git a/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/readme.md b/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/readme.md new file mode 100644 index 000000000..6e9e0f65c --- /dev/null +++ b/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/readme.md @@ -0,0 +1,22 @@ +# 242. Valid Anagram + +Given two strings s and t, return true if t is an anagram of s, and false otherwise. + +An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. + +## Example 1: + +Input: s = "anagram", t = "nagaram" +Output: true + +## Example 2: + +Input: s = "rat", t = "car" +Output: false + +## Constraints: +1 <= s.length, t.length <= 5 * 104 +s and t consist of lowercase English letters. + +## Follow up +What if the inputs contain Unicode characters? How would you adapt your solution to such a case? diff --git a/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs b/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs index aed4244cb..cc7a1dc47 100644 --- a/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs +++ b/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs @@ -4,14 +4,8 @@ namespace testCases; -public class Tests +public class ContainsDuplicate_Test { - [SetUp] - public void Setup() - { - - } - [Test] public void TestCase_1() { @@ -42,6 +36,11 @@ public void TestCase_2() [Test] public void TestCase_3() { - int[] input = {1, 1, 1, 3, 3, 4, 3, 2, 4, 2 }; + int[] input = { 1, 1, 1, 3, 3, 4, 3, 2, 4, 2 }; + + Solution solution = new Solution(); + bool testResult = solution.ContainsDuplicate(input); + + testResult.Should().Be(true); } } \ No newline at end of file diff --git a/csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs b/csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs new file mode 100644 index 000000000..0fdec4af0 --- /dev/null +++ b/csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs @@ -0,0 +1,25 @@ +using ArrayAndHashing.Main.Validanagram; +using FluentAssertions; +using NUnit.Framework; + +namespace testCases +{ + public class ValidAnagram_Test + { + + [Test] + public void Test_Example_1() + { + // Arrange + string s = "anagram"; + string t = "nagaram"; + + // Act + Solution solution = new Solution(); + bool testResult = solution.IsAnagram(s,t); + + // Assert + testResult.Should().Be(true); + } + } +} \ No newline at end of file From d98f3a5a66f0be43e250e92ff2f4f6557d15222b Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Tue, 3 May 2022 23:24:01 +0200 Subject: [PATCH 05/94] FEAT : solve N2-L242-ValidAnagrams --- .../main/N2-L242-ValidAnagram/Solution.cs | 60 ++++++++++++++++++- .../testCases/N2-L242-ValidAnagram_Test.cs | 15 +++++ 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs b/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs index f1e2379a3..7015953e0 100644 --- a/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs +++ b/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs @@ -4,7 +4,65 @@ public class Solution { public bool IsAnagram(string s, string t) { - return false; + if (s.Length != t.Length) + return false; + + Dictionary sDict = new(); + Dictionary tDict = new(); + for (int i = 0; i < s.Length; i++) + { + char sChar = s[i]; + char tChar = t[i]; + sDict = UpdateCharacterDictionary(sDict, sChar); + tDict = UpdateCharacterDictionary(tDict, tChar); + } + + return AreDictsEqual(sDict, tDict); + } + + private bool AreDictsEqual(Dictionary sDict, Dictionary tDict) + { + bool areEqual = true; + if (sDict.Count == tDict.Count) + { + foreach (var pair in sDict) + { + int tValue; + if (tDict.TryGetValue(pair.Key, out tValue)) + { + if (tValue != pair.Value) + { + // same values + areEqual = false; + break; + } + } + else + { + // all keys present + areEqual = false; + break; + } + } + } + else + { + areEqual = false; + } + + return areEqual; + } + + private static Dictionary UpdateCharacterDictionary(Dictionary aDict, char aChar) + { + if (aDict.ContainsKey(aChar)) + aDict[aChar] = +1; + else + { + aDict[aChar] = 1; + } + + return aDict; } } } \ No newline at end of file diff --git a/csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs b/csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs index 0fdec4af0..9387b0a2d 100644 --- a/csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs +++ b/csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs @@ -21,5 +21,20 @@ public void Test_Example_1() // Assert testResult.Should().Be(true); } + + [Test] + public void Test_Example_2() + { + // Arrange + string s = "rat"; + string t = "car"; + + // Act + Solution solution = new Solution(); + bool testResult = solution.IsAnagram(s, t); + + // Assert + testResult.Should().Be(false); + } } } \ No newline at end of file From 3f900e2480a5c0ddaa10d781d36e20494830f9b2 Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Tue, 3 May 2022 23:24:29 +0200 Subject: [PATCH 06/94] CHORE : edits .gitignore, add info on naming conventions --- .gitignore | 2 ++ README.md | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/.gitignore b/.gitignore index 8c7f0e804..882195282 100644 --- a/.gitignore +++ b/.gitignore @@ -131,3 +131,5 @@ $RECYCLE.BIN/ .DS_Store _NCrunch* +.vscode/launch.json +.vscode/tasks.json diff --git a/README.md b/README.md index 1a9c05b2b..b8035c91b 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,14 @@ I mostly do solutions in Python, but if you would like to contribute solutions f ## Fork This is my personal fork in github, where I am mostly adding C# code. + +### Naming convention + +For each exercise in https://neetcode.io/ we add : +- a folder in `csharp//main` +- a .cs file in `csharp//testCases` + +The name of the folder/files is `N-L-`, where : +- `` is the position of the exercise in https://neetcode.io/ +- `` is the number of the same exercise in LeetCode +- `` is the name of the problem on neetCode within its group \ No newline at end of file From 5fcd76128d56a9bb4971fef2f3b4797300149647 Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Tue, 3 May 2022 23:38:20 +0200 Subject: [PATCH 07/94] FEAT : remove ref assemblies that caused issued with debugger --- csharp/ArraysAndHashing/main/main.csproj | 1 + csharp/ArraysAndHashing/testCases/testCases.csproj | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/csharp/ArraysAndHashing/main/main.csproj b/csharp/ArraysAndHashing/main/main.csproj index 40c60dd4c..fd0732058 100644 --- a/csharp/ArraysAndHashing/main/main.csproj +++ b/csharp/ArraysAndHashing/main/main.csproj @@ -5,6 +5,7 @@ net6.0 enable enable + false diff --git a/csharp/ArraysAndHashing/testCases/testCases.csproj b/csharp/ArraysAndHashing/testCases/testCases.csproj index 04bdaa75b..f47708461 100644 --- a/csharp/ArraysAndHashing/testCases/testCases.csproj +++ b/csharp/ArraysAndHashing/testCases/testCases.csproj @@ -3,7 +3,8 @@ net6.0 enable - + + false false From 3b3640bb835ef9e3c33c7fb497ecf90a86eefafe Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Wed, 4 May 2022 00:32:40 +0200 Subject: [PATCH 08/94] FIX : pass test case 3 --- .../main/N2-L242-ValidAnagram/Solution.cs | 3 ++- .../testCases/N2-L242-ValidAnagram_Test.cs | 13 +++++++++++++ csharp/ArraysAndHashing/testCases/testCases.csproj | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs b/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs index 7015953e0..659c87dbf 100644 --- a/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs +++ b/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs @@ -1,5 +1,6 @@ namespace ArrayAndHashing.Main.Validanagram { + public class Solution { public bool IsAnagram(string s, string t) @@ -56,7 +57,7 @@ private bool AreDictsEqual(Dictionary sDict, Dictionary tD private static Dictionary UpdateCharacterDictionary(Dictionary aDict, char aChar) { if (aDict.ContainsKey(aChar)) - aDict[aChar] = +1; + aDict[aChar]++; else { aDict[aChar] = 1; diff --git a/csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs b/csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs index 9387b0a2d..117cc3bac 100644 --- a/csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs +++ b/csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs @@ -36,5 +36,18 @@ public void Test_Example_2() // Assert testResult.Should().Be(false); } + + [Test] + public void Test_Example_3() + { + string s = "aacc"; + string t = "ccac"; + + Solution solution = new Solution(); + bool testResult = solution.IsAnagram(s, t); + + // Assert + testResult.Should().Be(false); + } } } \ No newline at end of file diff --git a/csharp/ArraysAndHashing/testCases/testCases.csproj b/csharp/ArraysAndHashing/testCases/testCases.csproj index f47708461..c7c3cbe47 100644 --- a/csharp/ArraysAndHashing/testCases/testCases.csproj +++ b/csharp/ArraysAndHashing/testCases/testCases.csproj @@ -3,6 +3,7 @@ net6.0 enable + false false From a38182ef12db20180ba3c53ac7484775f0f84c18 Mon Sep 17 00:00:00 2001 From: Teto-at-GitHub Date: Wed, 4 May 2022 10:14:09 +0200 Subject: [PATCH 09/94] Update README.md --- README.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b8035c91b..d080f607e 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,6 @@ -# Leetcode solutions for [NeetCode](https://www.youtube.com/c/neetcode) +# Leetcode solutions for [NeetCode](https://www.youtube.com/c/neetcode) in C# -### Contributing - -I mostly do solutions in Python, but if you would like to contribute solutions for other common languages like Java, C++ and JavaScript, please feel free to make a pull request! :) - -## Fork - -This is my personal fork in github, where I am mostly adding C# code. +This is my personal fork of https://github.com/neetcode-gh/leetcode : I am mostly adding C# code. ### Naming convention @@ -17,4 +11,4 @@ For each exercise in https://neetcode.io/ we add : The name of the folder/files is `N-L-`, where : - `` is the position of the exercise in https://neetcode.io/ - `` is the number of the same exercise in LeetCode -- `` is the name of the problem on neetCode within its group \ No newline at end of file +- `` is the name of the problem on neetCode within its group From 80ea7a5ebfcb398f6743f8493b582db6c72b41d4 Mon Sep 17 00:00:00 2001 From: Teto-at-GitHub Date: Wed, 4 May 2022 10:14:29 +0200 Subject: [PATCH 10/94] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d080f607e..2e7607286 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Leetcode solutions for [NeetCode](https://www.youtube.com/c/neetcode) in C# -This is my personal fork of https://github.com/neetcode-gh/leetcode : I am mostly adding C# code. +This is my personal fork of https://github.com/neetcode-gh/leetcode : I am mostly adding C# solutions. ### Naming convention From f449399000aed6a4ff17d1a59257f4fff83a52bc Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Thu, 5 May 2022 20:42:07 +0200 Subject: [PATCH 11/94] FEAT : set up L3-N3-TwoSum --- .../main/N1-L217-ContainsDuplicate/readme.md | 4 ++- .../main/N2-L242-ValidAnagram/readme.md | 4 ++- .../main/N3-L1-TwoSum/Solution.cs | 10 ++++++ .../main/N3-L1-TwoSum/readme.md | 34 +++++++++++++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs create mode 100644 csharp/ArraysAndHashing/main/N3-L1-TwoSum/readme.md diff --git a/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md b/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md index 165aef5f3..6fc1e68c8 100644 --- a/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md +++ b/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md @@ -1,4 +1,6 @@ -# 217. Contains duplicate +# N1-L217. Contains duplicate + +https://leetcode.com/problems/contains-duplicate/ Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. diff --git a/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/readme.md b/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/readme.md index 6e9e0f65c..86f095dd3 100644 --- a/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/readme.md +++ b/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/readme.md @@ -1,4 +1,6 @@ -# 242. Valid Anagram +# N2-L242. Valid Anagram + +https://leetcode.com/problems/valid-anagram/ Given two strings s and t, return true if t is an anagram of s, and false otherwise. diff --git a/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs b/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs new file mode 100644 index 000000000..60b0bb8ee --- /dev/null +++ b/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs @@ -0,0 +1,10 @@ +namespace ArrayAndHashing.Main.TwoSum +{ + public class Solution + { + public int[] TwoSum(int[] nums, int target) + { + return nums; + } + } +} \ No newline at end of file diff --git a/csharp/ArraysAndHashing/main/N3-L1-TwoSum/readme.md b/csharp/ArraysAndHashing/main/N3-L1-TwoSum/readme.md new file mode 100644 index 000000000..a3a08236d --- /dev/null +++ b/csharp/ArraysAndHashing/main/N3-L1-TwoSum/readme.md @@ -0,0 +1,34 @@ +# N3-L1. Two Sum + +Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. + +You may assume that each input would have exactly one solution, and you may not use the same element twice. + +You can return the answer in any order. + +## Example 1: + +Input: nums = [2,7,11,15], target = 9 +Output: [0,1] +Explanation: Because nums[0] + nums[1] == 9, we return [0, 1]. + +## Example 2: + +Input: nums = [3,2,4], target = 6 +Output: [1,2] + +## Example 3: + +Input: nums = [3,3], target = 6 +Output: [0,1] + +## Constraints: + + 2 <= nums.length <= 104 + -109 <= nums[i] <= 109 + -109 <= target <= 109 + Only one valid answer exists. + + +## Follow-up +Can you come up with an algorithm that is less than O(n2) time complexity? \ No newline at end of file From 8d80cb61eea480a94133e732f7dbcd3429a171ec Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Thu, 5 May 2022 21:36:08 +0200 Subject: [PATCH 12/94] FEAT : Solve TwoSum --- .../main/N3-L1-TwoSum/Solution.cs | 23 +++++++-- csharp/ArraysAndHashing/omnisharp.json | 7 +++ .../testCases/N3-L1-TwoSum_Test.cs | 51 +++++++++++++++++++ 3 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 csharp/ArraysAndHashing/omnisharp.json create mode 100644 csharp/ArraysAndHashing/testCases/N3-L1-TwoSum_Test.cs diff --git a/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs b/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs index 60b0bb8ee..b4cf0c280 100644 --- a/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs +++ b/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs @@ -2,9 +2,26 @@ namespace ArrayAndHashing.Main.TwoSum { public class Solution { - public int[] TwoSum(int[] nums, int target) + +public int[] TwoSum(int[] nums, int target) { - return nums; + int[] retval = new int[2]; + r (int i = 0; i < nums.Length; i++) + { + for (int j = i + 1; j < nums.Length; j++) + { + if (nums[i] + nums[j] == target) + { + retval[0] = i; + al[1] = j; + break; + } + } + // retval[1] is never 0 in a successful sum + if (retval[1] != 0) + break; + } + return retval; } - } +} } \ No newline at end of file diff --git a/csharp/ArraysAndHashing/omnisharp.json b/csharp/ArraysAndHashing/omnisharp.json new file mode 100644 index 000000000..136488f3d --- /dev/null +++ b/csharp/ArraysAndHashing/omnisharp.json @@ -0,0 +1,7 @@ +{ + "FormattingOptions": { + "UseTabs": false, + "TabSize": 3, + "IndentationSize": 3 + } +} \ No newline at end of file diff --git a/csharp/ArraysAndHashing/testCases/N3-L1-TwoSum_Test.cs b/csharp/ArraysAndHashing/testCases/N3-L1-TwoSum_Test.cs new file mode 100644 index 000000000..4bb77d112 --- /dev/null +++ b/csharp/ArraysAndHashing/testCases/N3-L1-TwoSum_Test.cs @@ -0,0 +1,51 @@ +using ArrayAndHashing.Main.TwoSum; +using FluentAssertions; +using NUnit.Framework; + +namespace testCases +{ + public class TwoSum_Test + { + [Test] + public void Test_Example_1() + { + int[] nums = {2,7,11,15}; + int target = 9; + + Solution solution = new Solution(); + int[] testResult = solution.TwoSum(nums,target); + + testResult[0].Should().Be(0); + testResult[1].Should().Be(1); + + } + + [Test] + public void Test_Example_2() + { + int[] nums = { 3,2,4 }; + int target = 6; + + Solution solution = new Solution(); + int[] testResult = solution.TwoSum(nums, target); + + testResult[0].Should().Be(1); + testResult[1].Should().Be(2); + } + + [Test] + public void Test_Example_3() + { + int[] nums = { 3,3 }; + int target = 6; + + Solution solution = new Solution(); + int[] testResult = solution.TwoSum(nums, target); + + testResult[0].Should().Be(0); + testResult[1].Should().Be(1); + + } + + } +} \ No newline at end of file From 4359ae6e73aaee0a4240d4e968eae05c3cf209ec Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Thu, 5 May 2022 22:37:59 +0200 Subject: [PATCH 13/94] FEAT : adds O(n) solution to TwoSum --- .../main/N3-L1-TwoSum/Solution.cs | 47 +++++++-- .../testCases/N3-L1-TwoSum_Test.cs | 98 +++++++++++-------- 2 files changed, 94 insertions(+), 51 deletions(-) diff --git a/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs b/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs index b4cf0c280..09280b85b 100644 --- a/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs +++ b/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs @@ -3,17 +3,20 @@ namespace ArrayAndHashing.Main.TwoSum public class Solution { -public int[] TwoSum(int[] nums, int target) + // time complexity : O(n^2) + // space complexity : O(2n) + // where n = nums.Length + public int[] TwoSumN2(int[] nums, int target) { - int[] retval = new int[2]; - r (int i = 0; i < nums.Length; i++) + int[] retval = new int[2]; + for (int i = 0; i < nums.Length; i++) { - for (int j = i + 1; j < nums.Length; j++) + for (int j = i + 1; j < nums.Length; j++) { - if (nums[i] + nums[j] == target) + if (nums[i] + nums[j] == target) { - retval[0] = i; - al[1] = j; + retval[0] = i; + retval[1] = j; break; } } @@ -21,7 +24,33 @@ public int[] TwoSum(int[] nums, int target) if (retval[1] != 0) break; } - return retval; + return retval; } -} + + // time complexity : O(n) = only one for loop + + // in a Dictionary retrieval time by key is O(1) + // space complexity : O(n) = the size of the dictionary + public int[] TwoSum(int[] nums, int target) + { + int[] retval = new int[2]; + Dictionary map = new(); + for (int i = 0; i < nums.Length; i++) + { + int current_elem = nums[i]; + int diff = target - current_elem; + if (map.ContainsKey(diff)) + { + retval[0] = map[diff]; + retval[1] = i; + break; + } + // you may have repeated elements in nums, see test case 4 + if (!map.ContainsKey(current_elem)) + map.Add(current_elem, i); + } + return retval; + } + + } + } \ No newline at end of file diff --git a/csharp/ArraysAndHashing/testCases/N3-L1-TwoSum_Test.cs b/csharp/ArraysAndHashing/testCases/N3-L1-TwoSum_Test.cs index 4bb77d112..aee4c33fc 100644 --- a/csharp/ArraysAndHashing/testCases/N3-L1-TwoSum_Test.cs +++ b/csharp/ArraysAndHashing/testCases/N3-L1-TwoSum_Test.cs @@ -4,48 +4,62 @@ namespace testCases { - public class TwoSum_Test - { - [Test] - public void Test_Example_1() - { - int[] nums = {2,7,11,15}; - int target = 9; - - Solution solution = new Solution(); - int[] testResult = solution.TwoSum(nums,target); - - testResult[0].Should().Be(0); - testResult[1].Should().Be(1); - - } - - [Test] - public void Test_Example_2() - { - int[] nums = { 3,2,4 }; - int target = 6; - - Solution solution = new Solution(); - int[] testResult = solution.TwoSum(nums, target); - - testResult[0].Should().Be(1); - testResult[1].Should().Be(2); - } - - [Test] - public void Test_Example_3() - { - int[] nums = { 3,3 }; - int target = 6; - - Solution solution = new Solution(); - int[] testResult = solution.TwoSum(nums, target); - - testResult[0].Should().Be(0); - testResult[1].Should().Be(1); - - } + public class TwoSum_Test + { + [Test] + public void Test_Example_1() + { + int[] nums = { 2, 7, 11, 15 }; + int target = 9; + + Solution solution = new Solution(); + int[] testResult = solution.TwoSum(nums, target); + + testResult[0].Should().Be(0); + testResult[1].Should().Be(1); + + } + + [Test] + public void Test_Example_2() + { + int[] nums = { 3, 2, 4 }; + int target = 6; + + Solution solution = new Solution(); + int[] testResult = solution.TwoSum(nums, target); + + testResult[0].Should().Be(1); + testResult[1].Should().Be(2); + } + + [Test] + public void Test_Example_3() + { + int[] nums = { 3, 3 }; + int target = 6; + + Solution solution = new Solution(); + int[] testResult = solution.TwoSum(nums, target); + + testResult[0].Should().Be(0); + testResult[1].Should().Be(1); + + } + + [Test] + public void Test_Example_4() + { + int[] nums = { 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1 }; + int target = 11; + + Solution solution = new Solution(); + int[] testResult = solution.TwoSum(nums, target); + + testResult[0].Should().Be(5); + testResult[1].Should().Be(11); + + } } } \ No newline at end of file From bee20b62619419d9c32acd55a82c33faf76e7c25 Mon Sep 17 00:00:00 2001 From: Stefano Colucci Date: Sat, 7 May 2022 17:11:37 +0200 Subject: [PATCH 14/94] RESHARP : formatting exercise two sum --- .../main/N3-L1-TwoSum/Solution.cs | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs b/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs index 09280b85b..d3205de0d 100644 --- a/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs +++ b/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs @@ -1,56 +1,56 @@ namespace ArrayAndHashing.Main.TwoSum { - public class Solution - { + public class Solution + { - // time complexity : O(n^2) - // space complexity : O(2n) - // where n = nums.Length - public int[] TwoSumN2(int[] nums, int target) - { - int[] retval = new int[2]; - for (int i = 0; i < nums.Length; i++) + // time complexity : O(n^2) + // space complexity : O(2n) + // where n = nums.Length + public int[] TwoSumN2(int[] nums, int target) { - for (int j = i + 1; j < nums.Length; j++) - { - if (nums[i] + nums[j] == target) - { - retval[0] = i; - retval[1] = j; - break; - } - } - // retval[1] is never 0 in a successful sum - if (retval[1] != 0) - break; + int[] retval = new int[2]; + for (int i = 0; i < nums.Length; i++) + { + for (int j = i + 1; j < nums.Length; j++) + { + if (nums[i] + nums[j] == target) + { + retval[0] = i; + retval[1] = j; + break; + } + } + // retval[1] is never 0 in a successful sum + if (retval[1] != 0) + break; + } + return retval; } - return retval; - } - // time complexity : O(n) = only one for loop + - // in a Dictionary retrieval time by key is O(1) - // space complexity : O(n) = the size of the dictionary - public int[] TwoSum(int[] nums, int target) - { - int[] retval = new int[2]; - Dictionary map = new(); - for (int i = 0; i < nums.Length; i++) + // time complexity : O(n) = only one for loop + + // in a Dictionary retrieval time by key is O(1) + // space complexity : O(n) = the size of the dictionary + public int[] TwoSum(int[] nums, int target) { - int current_elem = nums[i]; - int diff = target - current_elem; - if (map.ContainsKey(diff)) - { - retval[0] = map[diff]; - retval[1] = i; - break; - } - // you may have repeated elements in nums, see test case 4 - if (!map.ContainsKey(current_elem)) - map.Add(current_elem, i); + int[] retval = new int[2]; + Dictionary map = new(); + for (int i = 0; i < nums.Length; i++) + { + int current_elem = nums[i]; + int diff = target - current_elem; + if (map.ContainsKey(diff)) + { + retval[0] = map[diff]; + retval[1] = i; + break; + } + // you may have repeated elements in nums, see test case 4 + if (!map.ContainsKey(current_elem)) + map.Add(current_elem, i); + } + return retval; } - return retval; - } - } + } } \ No newline at end of file From b940af9c104c23961b63f34fede770805b938744 Mon Sep 17 00:00:00 2001 From: Stefano Colucci Date: Sat, 7 May 2022 17:59:45 +0200 Subject: [PATCH 15/94] CHORE : sets up chapter "TwoPointers" --- csharp/TwoPointers/build.proj | 5 +++++ csharp/TwoPointers/main/Program.cs | 2 ++ csharp/TwoPointers/main/main.csproj | 10 ++++++++++ csharp/TwoPointers/testCases/UnitTest1.cs | 17 +++++++++++++++++ csharp/TwoPointers/testCases/testCases.csproj | 17 +++++++++++++++++ 5 files changed, 51 insertions(+) create mode 100644 csharp/TwoPointers/build.proj create mode 100644 csharp/TwoPointers/main/Program.cs create mode 100644 csharp/TwoPointers/main/main.csproj create mode 100644 csharp/TwoPointers/testCases/UnitTest1.cs create mode 100644 csharp/TwoPointers/testCases/testCases.csproj diff --git a/csharp/TwoPointers/build.proj b/csharp/TwoPointers/build.proj new file mode 100644 index 000000000..f63ef53ad --- /dev/null +++ b/csharp/TwoPointers/build.proj @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/csharp/TwoPointers/main/Program.cs b/csharp/TwoPointers/main/Program.cs new file mode 100644 index 000000000..3751555cb --- /dev/null +++ b/csharp/TwoPointers/main/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/csharp/TwoPointers/main/main.csproj b/csharp/TwoPointers/main/main.csproj new file mode 100644 index 000000000..74abf5c97 --- /dev/null +++ b/csharp/TwoPointers/main/main.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/csharp/TwoPointers/testCases/UnitTest1.cs b/csharp/TwoPointers/testCases/UnitTest1.cs new file mode 100644 index 000000000..9046be5be --- /dev/null +++ b/csharp/TwoPointers/testCases/UnitTest1.cs @@ -0,0 +1,17 @@ +using NUnit.Framework; + +namespace testCases; + +public class Tests +{ + [SetUp] + public void Setup() + { + } + + [Test] + public void Test1() + { + Assert.Pass(); + } +} \ No newline at end of file diff --git a/csharp/TwoPointers/testCases/testCases.csproj b/csharp/TwoPointers/testCases/testCases.csproj new file mode 100644 index 000000000..50852359b --- /dev/null +++ b/csharp/TwoPointers/testCases/testCases.csproj @@ -0,0 +1,17 @@ + + + + net6.0 + enable + + false + + + + + + + + + + From 376de58f572f04d41b587d91ffc6a0b6c1141963 Mon Sep 17 00:00:00 2001 From: Stefano Colucci Date: Sat, 7 May 2022 18:59:20 +0200 Subject: [PATCH 16/94] FEAT : a first working solution to the two pointer problem --- .../main/N1-L125-ValidPalindrome/Solution.cs | 29 +++++++++++ .../main/N1-L125-ValidPalindrome/readme.md | 29 +++++++++++ .../testCases/N1-L125-ValidPalindrome_Test.cs | 51 +++++++++++++++++++ csharp/TwoPointers/testCases/testCases.csproj | 2 + 4 files changed, 111 insertions(+) create mode 100644 csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs create mode 100644 csharp/TwoPointers/main/N1-L125-ValidPalindrome/readme.md create mode 100644 csharp/TwoPointers/testCases/N1-L125-ValidPalindrome_Test.cs diff --git a/csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs b/csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs new file mode 100644 index 000000000..ecfb4896a --- /dev/null +++ b/csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs @@ -0,0 +1,29 @@ +using System.Text.RegularExpressions; + +namespace TwoPointers.Main.ValidPalindrome +{ + public class Solution + { + public bool IsPalindrome(string s) + { + List cleanInput = new(); + foreach (char item in s) + { + Regex regex = new Regex("[a-zA-Z0-9]"); + Match match = regex.Match(item.ToString()); + + if (match.Success) + cleanInput.Add(item.ToString().ToLower().ElementAt(0)); + } + + int cleanInputLength = cleanInput.Count; + for (int i = 0; i < cleanInputLength / 2; i++) + { + if (cleanInput[i] != cleanInput[cleanInputLength - 1 - i]) + return false; + } + + return true; + } + } +} \ No newline at end of file diff --git a/csharp/TwoPointers/main/N1-L125-ValidPalindrome/readme.md b/csharp/TwoPointers/main/N1-L125-ValidPalindrome/readme.md new file mode 100644 index 000000000..096ad8dee --- /dev/null +++ b/csharp/TwoPointers/main/N1-L125-ValidPalindrome/readme.md @@ -0,0 +1,29 @@ +# N1-L125. Valid Palindrome + +A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. + +Given a string s, return true if it is a palindrome, or false otherwise. + +## Example 1: + +Input: s = "A man, a plan, a canal: Panama" +Output: true +Explanation: "amanaplanacanalpanama" is a palindrome. + +## Example 2: + +Input: s = "race a car" +Output: false +Explanation: "raceacar" is not a palindrome. + +## Example 3: + +Input: s = " " +Output: true +Explanation: s is an empty string "" after removing non-alphanumeric characters. +Since an empty string reads the same forward and backward, it is a palindrome. + +## Constraints: + + 1 <= s.length <= 2 * 105 + s consists only of printable ASCII characters. \ No newline at end of file diff --git a/csharp/TwoPointers/testCases/N1-L125-ValidPalindrome_Test.cs b/csharp/TwoPointers/testCases/N1-L125-ValidPalindrome_Test.cs new file mode 100644 index 000000000..ff8431ff3 --- /dev/null +++ b/csharp/TwoPointers/testCases/N1-L125-ValidPalindrome_Test.cs @@ -0,0 +1,51 @@ +using TwoPointers.Main.ValidPalindrome; +using FluentAssertions; +using NUnit.Framework; + +namespace testCases +{ + public class ValidPalindrome_Test + { + + [Test] + public void Test_Example_1() + { + // Arrange + string input = "A man, a plan, a canal: Panama"; + // Act + Solution solution = new Solution(); + bool testResult = solution.IsPalindrome(input); + + // Assert + testResult.Should().Be(true); + } + + [Test] + public void Test_Example_2() + { + // Given + string input = "race a car"; + + // When + Solution solution = new Solution(); + bool testResult = solution.IsPalindrome(input); + + // Then + testResult.Should().Be(false); + } + + [Test] + public void Test_Example_3() + { + // Given + string input = " "; + + // When + Solution solution = new Solution(); + bool testResult = solution.IsPalindrome(input); + + // Then + testResult.Should().Be(true); + } + } +} \ No newline at end of file diff --git a/csharp/TwoPointers/testCases/testCases.csproj b/csharp/TwoPointers/testCases/testCases.csproj index 50852359b..923ca5701 100644 --- a/csharp/TwoPointers/testCases/testCases.csproj +++ b/csharp/TwoPointers/testCases/testCases.csproj @@ -8,6 +8,8 @@ + + From ac260d11308124ab6db60007b717c29522ce8cf5 Mon Sep 17 00:00:00 2001 From: Stefano Colucci Date: Sat, 7 May 2022 19:44:52 +0200 Subject: [PATCH 17/94] FEAT : adds an improved solution and a faster one actually using pointers --- .../main/N1-L125-ValidPalindrome/Solution.cs | 72 ++++++++++++++++--- 1 file changed, 61 insertions(+), 11 deletions(-) diff --git a/csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs b/csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs index ecfb4896a..9bcca5b3c 100644 --- a/csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs +++ b/csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs @@ -6,24 +6,74 @@ public class Solution { public bool IsPalindrome(string s) { - List cleanInput = new(); - foreach (char item in s) - { - Regex regex = new Regex("[a-zA-Z0-9]"); - Match match = regex.Match(item.ToString()); + //FIRST SUBMISSION + // List cleanInput = new(); + // foreach (char item in s) + // { + // Regex regex = new Regex("[a-zA-Z0-9]"); + // Match match = regex.Match(item.ToString()); - if (match.Success) - cleanInput.Add(item.ToString().ToLower().ElementAt(0)); - } + // if (match.Success) + // cleanInput.Add(item.ToString().ToLower().ElementAt(0)); + // } + + // A bit slower + // int cleanInputLength = cleanInput.Count; + // for (int i = 0; i < cleanInputLength / 2; i++) + // { + // if (cleanInput[i] != cleanInput[cleanInputLength - 1 - i]) + // return false; + // } + + // FINAL submission + // I like this solution because : + // - it's faster than the previous one : 81 < 586 + // - it uses built-in fcts to perform the checks : + // - if a char is alphanumeric + // - if the cleaned up string is a palindrome + // - it reduces the ammount of back and forth between char list or arrays and strings + string str = s.ToLower(); + char[] cleaInputCharArr = str.Where(c => Char.IsLetterOrDigit(c)).ToArray(); + + string cleanInputString = new(cleaInputCharArr); + Array.Reverse(cleaInputCharArr); + string reversedString = new(cleaInputCharArr); + if (cleanInputString == reversedString) + return true; + + return false; + } - int cleanInputLength = cleanInput.Count; - for (int i = 0; i < cleanInputLength / 2; i++) + // This solution ( taken from LeetCode) is super fast (51 ms) and actually uses pointers + public bool IsPalindromeInsane(string st) + { + var s = st.ToLower(); + + int left = 0; + int right = s.Length - 1; + + while (left < right) { - if (cleanInput[i] != cleanInput[cleanInputLength - 1 - i]) + while (left < right && !Char.IsLetterOrDigit(s[left])) + { + left++; + } + while (left < right && !Char.IsLetterOrDigit(s[right])) + { + right--; + } + + if (s[left] != s[right]) + { return false; + } + left++; + right--; } return true; } } + + } \ No newline at end of file From 6e727f570c908772aae4216a8c4c841904618aff Mon Sep 17 00:00:00 2001 From: Stefano Colucci Date: Sat, 7 May 2022 19:45:11 +0200 Subject: [PATCH 18/94] CHORE : find all tests --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 775531661..105111601 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "dotnet-test-explorer.testProjectPath": "**/**/testCases.csproj" + "dotnet-test-explorer.testProjectPath": "**/**/testCases/testCases.csproj" } \ No newline at end of file From 51098ebcd57dd8df92ca4f006dfffd946e6b763c Mon Sep 17 00:00:00 2001 From: Stefano Colucci Date: Sat, 7 May 2022 19:45:40 +0200 Subject: [PATCH 19/94] CHORE : removes useless settings file --- csharp/ArraysAndHashing/omnisharp.json | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 csharp/ArraysAndHashing/omnisharp.json diff --git a/csharp/ArraysAndHashing/omnisharp.json b/csharp/ArraysAndHashing/omnisharp.json deleted file mode 100644 index 136488f3d..000000000 --- a/csharp/ArraysAndHashing/omnisharp.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "FormattingOptions": { - "UseTabs": false, - "TabSize": 3, - "IndentationSize": 3 - } -} \ No newline at end of file From 84cf2a2fc20197efb33c32bab86d81d04f386a8a Mon Sep 17 00:00:00 2001 From: Stefano Colucci Date: Sat, 7 May 2022 19:51:11 +0200 Subject: [PATCH 20/94] DOC : adds comment --- csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs b/csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs index 9bcca5b3c..4866e265b 100644 --- a/csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs +++ b/csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs @@ -4,6 +4,7 @@ namespace TwoPointers.Main.ValidPalindrome { public class Solution { + // I am not sure of the complexity of my solution :-( public bool IsPalindrome(string s) { //FIRST SUBMISSION @@ -44,7 +45,11 @@ public bool IsPalindrome(string s) return false; } + // **BEST** // This solution ( taken from LeetCode) is super fast (51 ms) and actually uses pointers + // It's the C# version of the one suggested by NeetCode + // time complexity : O(n) + // memory complexity : O(1) public bool IsPalindromeInsane(string st) { var s = st.ToLower(); From aa7fe5f2e73efed7ebbcad2cd9fb2414831a4fad Mon Sep 17 00:00:00 2001 From: Stefano Colucci Date: Sun, 8 May 2022 17:05:19 +0200 Subject: [PATCH 21/94] FEAT, CHORE : solves L121, changes dir names --- .../build.proj | 0 .../N1-L217-ContainsDuplicate/Solution.cs | 0 .../main/N1-L217-ContainsDuplicate/readme.md | 0 .../main/N2-L242-ValidAnagram/Solution.cs | 0 .../main/N2-L242-ValidAnagram/readme.md | 0 .../main/N3-L1-TwoSum/Solution.cs | 0 .../main/N3-L1-TwoSum/readme.md | 0 .../main/Program.cs | 0 .../main/main.csproj | 22 ++--- .../N1-L217-ContainsDuplicate_Test.cs | 90 +++++++++---------- .../testCases/N2-L242-ValidAnagram_Test.cs | 0 .../testCases/N3-L1-TwoSum_Test.cs | 0 .../testCases/testCases.csproj | 42 ++++----- .../{TwoPointers => 2-TwoPointers}/build.proj | 0 .../main/N1-L125-ValidPalindrome/Solution.cs | 0 .../main/N1-L125-ValidPalindrome/readme.md | 0 .../main/Program.cs | 4 +- .../main/main.csproj | 0 .../testCases/N1-L125-ValidPalindrome_Test.cs | 0 .../testCases/testCases.csproj | 0 csharp/3-SlidingWindow/build.proj | 5 ++ .../main/N1-L121-BestTime4Stocks/Solution.cs | 32 +++++++ .../main/N1-L121-BestTime4Stocks/readme.md | 30 +++++++ csharp/3-SlidingWindow/main/Program.cs | 2 + csharp/3-SlidingWindow/main/main.csproj | 10 +++ .../testCases/N1-L121-BestTime4Stocks_Test.cs | 32 +++++++ .../testCases/testCases.csproj | 19 ++++ csharp/TwoPointers/testCases/UnitTest1.cs | 17 ---- 28 files changed, 209 insertions(+), 96 deletions(-) rename csharp/{ArraysAndHashing => 1-ArraysAndHashing}/build.proj (100%) rename csharp/{ArraysAndHashing => 1-ArraysAndHashing}/main/N1-L217-ContainsDuplicate/Solution.cs (100%) rename csharp/{ArraysAndHashing => 1-ArraysAndHashing}/main/N1-L217-ContainsDuplicate/readme.md (100%) rename csharp/{ArraysAndHashing => 1-ArraysAndHashing}/main/N2-L242-ValidAnagram/Solution.cs (100%) rename csharp/{ArraysAndHashing => 1-ArraysAndHashing}/main/N2-L242-ValidAnagram/readme.md (100%) rename csharp/{ArraysAndHashing => 1-ArraysAndHashing}/main/N3-L1-TwoSum/Solution.cs (100%) rename csharp/{ArraysAndHashing => 1-ArraysAndHashing}/main/N3-L1-TwoSum/readme.md (100%) rename csharp/{TwoPointers => 1-ArraysAndHashing}/main/Program.cs (100%) rename csharp/{ArraysAndHashing => 1-ArraysAndHashing}/main/main.csproj (96%) rename csharp/{ArraysAndHashing => 1-ArraysAndHashing}/testCases/N1-L217-ContainsDuplicate_Test.cs (95%) rename csharp/{ArraysAndHashing => 1-ArraysAndHashing}/testCases/N2-L242-ValidAnagram_Test.cs (100%) rename csharp/{ArraysAndHashing => 1-ArraysAndHashing}/testCases/N3-L1-TwoSum_Test.cs (100%) rename csharp/{ArraysAndHashing => 1-ArraysAndHashing}/testCases/testCases.csproj (90%) rename csharp/{TwoPointers => 2-TwoPointers}/build.proj (100%) rename csharp/{TwoPointers => 2-TwoPointers}/main/N1-L125-ValidPalindrome/Solution.cs (100%) rename csharp/{TwoPointers => 2-TwoPointers}/main/N1-L125-ValidPalindrome/readme.md (100%) rename csharp/{ArraysAndHashing => 2-TwoPointers}/main/Program.cs (98%) rename csharp/{TwoPointers => 2-TwoPointers}/main/main.csproj (100%) rename csharp/{TwoPointers => 2-TwoPointers}/testCases/N1-L125-ValidPalindrome_Test.cs (100%) rename csharp/{TwoPointers => 2-TwoPointers}/testCases/testCases.csproj (100%) create mode 100644 csharp/3-SlidingWindow/build.proj create mode 100644 csharp/3-SlidingWindow/main/N1-L121-BestTime4Stocks/Solution.cs create mode 100644 csharp/3-SlidingWindow/main/N1-L121-BestTime4Stocks/readme.md create mode 100644 csharp/3-SlidingWindow/main/Program.cs create mode 100644 csharp/3-SlidingWindow/main/main.csproj create mode 100644 csharp/3-SlidingWindow/testCases/N1-L121-BestTime4Stocks_Test.cs create mode 100644 csharp/3-SlidingWindow/testCases/testCases.csproj delete mode 100644 csharp/TwoPointers/testCases/UnitTest1.cs diff --git a/csharp/ArraysAndHashing/build.proj b/csharp/1-ArraysAndHashing/build.proj similarity index 100% rename from csharp/ArraysAndHashing/build.proj rename to csharp/1-ArraysAndHashing/build.proj diff --git a/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/Solution.cs b/csharp/1-ArraysAndHashing/main/N1-L217-ContainsDuplicate/Solution.cs similarity index 100% rename from csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/Solution.cs rename to csharp/1-ArraysAndHashing/main/N1-L217-ContainsDuplicate/Solution.cs diff --git a/csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md b/csharp/1-ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md similarity index 100% rename from csharp/ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md rename to csharp/1-ArraysAndHashing/main/N1-L217-ContainsDuplicate/readme.md diff --git a/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs b/csharp/1-ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs similarity index 100% rename from csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs rename to csharp/1-ArraysAndHashing/main/N2-L242-ValidAnagram/Solution.cs diff --git a/csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/readme.md b/csharp/1-ArraysAndHashing/main/N2-L242-ValidAnagram/readme.md similarity index 100% rename from csharp/ArraysAndHashing/main/N2-L242-ValidAnagram/readme.md rename to csharp/1-ArraysAndHashing/main/N2-L242-ValidAnagram/readme.md diff --git a/csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs b/csharp/1-ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs similarity index 100% rename from csharp/ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs rename to csharp/1-ArraysAndHashing/main/N3-L1-TwoSum/Solution.cs diff --git a/csharp/ArraysAndHashing/main/N3-L1-TwoSum/readme.md b/csharp/1-ArraysAndHashing/main/N3-L1-TwoSum/readme.md similarity index 100% rename from csharp/ArraysAndHashing/main/N3-L1-TwoSum/readme.md rename to csharp/1-ArraysAndHashing/main/N3-L1-TwoSum/readme.md diff --git a/csharp/TwoPointers/main/Program.cs b/csharp/1-ArraysAndHashing/main/Program.cs similarity index 100% rename from csharp/TwoPointers/main/Program.cs rename to csharp/1-ArraysAndHashing/main/Program.cs diff --git a/csharp/ArraysAndHashing/main/main.csproj b/csharp/1-ArraysAndHashing/main/main.csproj similarity index 96% rename from csharp/ArraysAndHashing/main/main.csproj rename to csharp/1-ArraysAndHashing/main/main.csproj index fd0732058..937ea0c93 100644 --- a/csharp/ArraysAndHashing/main/main.csproj +++ b/csharp/1-ArraysAndHashing/main/main.csproj @@ -1,11 +1,11 @@ - - - - Exe - net6.0 - enable - enable - false - - - + + + + Exe + net6.0 + enable + enable + false + + + diff --git a/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs b/csharp/1-ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs similarity index 95% rename from csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs rename to csharp/1-ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs index cc7a1dc47..445726dac 100644 --- a/csharp/ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs +++ b/csharp/1-ArraysAndHashing/testCases/N1-L217-ContainsDuplicate_Test.cs @@ -1,46 +1,46 @@ -using NUnit.Framework; -using ArrayAndHashing.Main.ContainsDuplicate; -using FluentAssertions; - -namespace testCases; - -public class ContainsDuplicate_Test -{ - [Test] - public void TestCase_1() - { - // Arrange - int[] input = { 1, 2, 3, 1 }; - - // Act - Solution solution = new Solution(); - bool testResult = solution.ContainsDuplicate(input); - - // Assert - testResult.Should().Be(true); - } - - [Test] - public void TestCase_2() - { - int[] input = { 1, 2, 3, 4 }; - - // Act - Solution solution = new Solution(); - bool testResult = solution.ContainsDuplicate(input); - - // Assert - testResult.Should().Be(false); - } - - [Test] - public void TestCase_3() - { - int[] input = { 1, 1, 1, 3, 3, 4, 3, 2, 4, 2 }; - - Solution solution = new Solution(); - bool testResult = solution.ContainsDuplicate(input); - - testResult.Should().Be(true); - } +using NUnit.Framework; +using ArrayAndHashing.Main.ContainsDuplicate; +using FluentAssertions; + +namespace testCases; + +public class ContainsDuplicate_Test +{ + [Test] + public void TestCase_1() + { + // Arrange + int[] input = { 1, 2, 3, 1 }; + + // Act + Solution solution = new Solution(); + bool testResult = solution.ContainsDuplicate(input); + + // Assert + testResult.Should().Be(true); + } + + [Test] + public void TestCase_2() + { + int[] input = { 1, 2, 3, 4 }; + + // Act + Solution solution = new Solution(); + bool testResult = solution.ContainsDuplicate(input); + + // Assert + testResult.Should().Be(false); + } + + [Test] + public void TestCase_3() + { + int[] input = { 1, 1, 1, 3, 3, 4, 3, 2, 4, 2 }; + + Solution solution = new Solution(); + bool testResult = solution.ContainsDuplicate(input); + + testResult.Should().Be(true); + } } \ No newline at end of file diff --git a/csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs b/csharp/1-ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs similarity index 100% rename from csharp/ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs rename to csharp/1-ArraysAndHashing/testCases/N2-L242-ValidAnagram_Test.cs diff --git a/csharp/ArraysAndHashing/testCases/N3-L1-TwoSum_Test.cs b/csharp/1-ArraysAndHashing/testCases/N3-L1-TwoSum_Test.cs similarity index 100% rename from csharp/ArraysAndHashing/testCases/N3-L1-TwoSum_Test.cs rename to csharp/1-ArraysAndHashing/testCases/N3-L1-TwoSum_Test.cs diff --git a/csharp/ArraysAndHashing/testCases/testCases.csproj b/csharp/1-ArraysAndHashing/testCases/testCases.csproj similarity index 90% rename from csharp/ArraysAndHashing/testCases/testCases.csproj rename to csharp/1-ArraysAndHashing/testCases/testCases.csproj index c7c3cbe47..ee38ab734 100644 --- a/csharp/ArraysAndHashing/testCases/testCases.csproj +++ b/csharp/1-ArraysAndHashing/testCases/testCases.csproj @@ -1,21 +1,21 @@ - - - - net6.0 - enable - - - false - false - - - - - - - - - - - - + + + + net6.0 + enable + + + false + false + + + + + + + + + + + + diff --git a/csharp/TwoPointers/build.proj b/csharp/2-TwoPointers/build.proj similarity index 100% rename from csharp/TwoPointers/build.proj rename to csharp/2-TwoPointers/build.proj diff --git a/csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs b/csharp/2-TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs similarity index 100% rename from csharp/TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs rename to csharp/2-TwoPointers/main/N1-L125-ValidPalindrome/Solution.cs diff --git a/csharp/TwoPointers/main/N1-L125-ValidPalindrome/readme.md b/csharp/2-TwoPointers/main/N1-L125-ValidPalindrome/readme.md similarity index 100% rename from csharp/TwoPointers/main/N1-L125-ValidPalindrome/readme.md rename to csharp/2-TwoPointers/main/N1-L125-ValidPalindrome/readme.md diff --git a/csharp/ArraysAndHashing/main/Program.cs b/csharp/2-TwoPointers/main/Program.cs similarity index 98% rename from csharp/ArraysAndHashing/main/Program.cs rename to csharp/2-TwoPointers/main/Program.cs index 83fa4f4d5..3751555cb 100644 --- a/csharp/ArraysAndHashing/main/Program.cs +++ b/csharp/2-TwoPointers/main/Program.cs @@ -1,2 +1,2 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/csharp/TwoPointers/main/main.csproj b/csharp/2-TwoPointers/main/main.csproj similarity index 100% rename from csharp/TwoPointers/main/main.csproj rename to csharp/2-TwoPointers/main/main.csproj diff --git a/csharp/TwoPointers/testCases/N1-L125-ValidPalindrome_Test.cs b/csharp/2-TwoPointers/testCases/N1-L125-ValidPalindrome_Test.cs similarity index 100% rename from csharp/TwoPointers/testCases/N1-L125-ValidPalindrome_Test.cs rename to csharp/2-TwoPointers/testCases/N1-L125-ValidPalindrome_Test.cs diff --git a/csharp/TwoPointers/testCases/testCases.csproj b/csharp/2-TwoPointers/testCases/testCases.csproj similarity index 100% rename from csharp/TwoPointers/testCases/testCases.csproj rename to csharp/2-TwoPointers/testCases/testCases.csproj diff --git a/csharp/3-SlidingWindow/build.proj b/csharp/3-SlidingWindow/build.proj new file mode 100644 index 000000000..f63ef53ad --- /dev/null +++ b/csharp/3-SlidingWindow/build.proj @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/csharp/3-SlidingWindow/main/N1-L121-BestTime4Stocks/Solution.cs b/csharp/3-SlidingWindow/main/N1-L121-BestTime4Stocks/Solution.cs new file mode 100644 index 000000000..32d2217e2 --- /dev/null +++ b/csharp/3-SlidingWindow/main/N1-L121-BestTime4Stocks/Solution.cs @@ -0,0 +1,32 @@ +namespace SlidingWindow.Main.BestTime4Stocks +{ + public class Solution + { + // time complexity : O(n), n = prices.length, bc only go through the array once + // space complexity : O(1), because you are using pointers + public int MaxProfit(int[] prices) + { + int buyDay = 0; // left pointer + int sellDay = 1; // right pointer + int maxProfit = 0; + + while (sellDay < prices.Length) + { + // check if current transaction can be profitable + if (prices[buyDay] < prices[sellDay]) + { + // calculate revenue + int currentProfit = prices[sellDay] - prices[buyDay]; + // update max possible profit if needed be + maxProfit = Math.Max(maxProfit, currentProfit); + } + else + buyDay = sellDay; + + sellDay++; + } + + return maxProfit; + } + } +} \ No newline at end of file diff --git a/csharp/3-SlidingWindow/main/N1-L121-BestTime4Stocks/readme.md b/csharp/3-SlidingWindow/main/N1-L121-BestTime4Stocks/readme.md new file mode 100644 index 000000000..d9e5a0444 --- /dev/null +++ b/csharp/3-SlidingWindow/main/N1-L121-BestTime4Stocks/readme.md @@ -0,0 +1,30 @@ +# N1-L121. Best Time to Buy and Sell Stock + +Easy + +You are given an array prices where prices[i] is the price of a given stock on the ith day. + +You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. + +Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0. + + +## Example 1: + +Input: prices = [7,1,5,3,6,4] +Output: 5 +Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5. +Note that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell. + +## Example 2: + +Input: prices = [7,6,4,3,1] +Output: 0 +Explanation: In this case, no transactions are done and the max profit = 0. + + +## Constraints: + + 1 <= prices.length <= 105 + 0 <= prices[i] <= 104 + diff --git a/csharp/3-SlidingWindow/main/Program.cs b/csharp/3-SlidingWindow/main/Program.cs new file mode 100644 index 000000000..3751555cb --- /dev/null +++ b/csharp/3-SlidingWindow/main/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/csharp/3-SlidingWindow/main/main.csproj b/csharp/3-SlidingWindow/main/main.csproj new file mode 100644 index 000000000..74abf5c97 --- /dev/null +++ b/csharp/3-SlidingWindow/main/main.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/csharp/3-SlidingWindow/testCases/N1-L121-BestTime4Stocks_Test.cs b/csharp/3-SlidingWindow/testCases/N1-L121-BestTime4Stocks_Test.cs new file mode 100644 index 000000000..a7a8ea2dc --- /dev/null +++ b/csharp/3-SlidingWindow/testCases/N1-L121-BestTime4Stocks_Test.cs @@ -0,0 +1,32 @@ + +using FluentAssertions; +using NUnit.Framework; +using SlidingWindow.Main.BestTime4Stocks; + +namespace testCases; + +public class BestTime4Stocks_Test +{ + + [Test] + public void Test_Example_1() + { + int[] prices = {7, 1, 5, 3, 6, 4}; + + Solution solution = new Solution(); + int testResult = solution.MaxProfit(prices); + + testResult.Should().Be(5); + } + + [Test] + public void Test_Example_2() + { + int[] prices = { 7, 6, 4, 3, 1 }; + + Solution solution = new Solution(); + int testResult = solution.MaxProfit(prices); + + testResult.Should().Be(0); + } +} \ No newline at end of file diff --git a/csharp/3-SlidingWindow/testCases/testCases.csproj b/csharp/3-SlidingWindow/testCases/testCases.csproj new file mode 100644 index 000000000..2af991855 --- /dev/null +++ b/csharp/3-SlidingWindow/testCases/testCases.csproj @@ -0,0 +1,19 @@ + + + + net6.0 + enable + + false + + + + + + + + + + + + diff --git a/csharp/TwoPointers/testCases/UnitTest1.cs b/csharp/TwoPointers/testCases/UnitTest1.cs deleted file mode 100644 index 9046be5be..000000000 --- a/csharp/TwoPointers/testCases/UnitTest1.cs +++ /dev/null @@ -1,17 +0,0 @@ -using NUnit.Framework; - -namespace testCases; - -public class Tests -{ - [SetUp] - public void Setup() - { - } - - [Test] - public void Test1() - { - Assert.Pass(); - } -} \ No newline at end of file From 7e0babb965d37e3754f8a48584643d77dc674030 Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Mon, 9 May 2022 19:51:40 +0200 Subject: [PATCH 22/94] FEAT : set up L20 - Valid Parentheses --- csharp/4-Stack/build.proj | 5 +++ .../main/N1-L20-ValidParentheses/Solution.cs | 11 +++++++ .../main/N1-L20-ValidParentheses/readme.md | 33 +++++++++++++++++++ csharp/4-Stack/main/Program.cs | 2 ++ csharp/4-Stack/main/main.csproj | 10 ++++++ .../testCases/N1-L20-ValidParentheses_Test.cs | 20 +++++++++++ csharp/4-Stack/testCases/testCases.csproj | 19 +++++++++++ 7 files changed, 100 insertions(+) create mode 100644 csharp/4-Stack/build.proj create mode 100644 csharp/4-Stack/main/N1-L20-ValidParentheses/Solution.cs create mode 100644 csharp/4-Stack/main/N1-L20-ValidParentheses/readme.md create mode 100644 csharp/4-Stack/main/Program.cs create mode 100644 csharp/4-Stack/main/main.csproj create mode 100644 csharp/4-Stack/testCases/N1-L20-ValidParentheses_Test.cs create mode 100644 csharp/4-Stack/testCases/testCases.csproj diff --git a/csharp/4-Stack/build.proj b/csharp/4-Stack/build.proj new file mode 100644 index 000000000..f63ef53ad --- /dev/null +++ b/csharp/4-Stack/build.proj @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/csharp/4-Stack/main/N1-L20-ValidParentheses/Solution.cs b/csharp/4-Stack/main/N1-L20-ValidParentheses/Solution.cs new file mode 100644 index 000000000..e79b6da8d --- /dev/null +++ b/csharp/4-Stack/main/N1-L20-ValidParentheses/Solution.cs @@ -0,0 +1,11 @@ +namespace Stack.Main.ValidParentheses +{ + public class Solution + { + public bool IsValid(string s) + { + return false; + } + } + +} \ No newline at end of file diff --git a/csharp/4-Stack/main/N1-L20-ValidParentheses/readme.md b/csharp/4-Stack/main/N1-L20-ValidParentheses/readme.md new file mode 100644 index 000000000..1845b51ba --- /dev/null +++ b/csharp/4-Stack/main/N1-L20-ValidParentheses/readme.md @@ -0,0 +1,33 @@ +# N1-L20. Valid Parentheses +Easy + +Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. + +An input string is valid if: + + Open brackets must be closed by the same type of brackets. + Open brackets must be closed in the correct order. + + +## Example 1: + +Input: s = "()" +Output: true + +## Example 2: + +Input: s = "()[]{}" +Output: true + +## Example 3: + +Input: s = "(]" +Output: false + + + +Constraints: + + 1 <= s.length <= 104 + s consists of parentheses only '()[]{}'. + diff --git a/csharp/4-Stack/main/Program.cs b/csharp/4-Stack/main/Program.cs new file mode 100644 index 000000000..83fa4f4d5 --- /dev/null +++ b/csharp/4-Stack/main/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/csharp/4-Stack/main/main.csproj b/csharp/4-Stack/main/main.csproj new file mode 100644 index 000000000..40c60dd4c --- /dev/null +++ b/csharp/4-Stack/main/main.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/csharp/4-Stack/testCases/N1-L20-ValidParentheses_Test.cs b/csharp/4-Stack/testCases/N1-L20-ValidParentheses_Test.cs new file mode 100644 index 000000000..7601c3ef9 --- /dev/null +++ b/csharp/4-Stack/testCases/N1-L20-ValidParentheses_Test.cs @@ -0,0 +1,20 @@ +using FluentAssertions; +using NUnit.Framework; +using Stack.Main.ValidParentheses; + +namespace testCases; + +public class ValidParentheses_Tests +{ + + [Test] + public void Test_Example_1() + { + string input = "()"; + + Solution solution = new(); + bool testResult = solution.IsValid(input); + + testResult.Should().Be(true); + } +} \ No newline at end of file diff --git a/csharp/4-Stack/testCases/testCases.csproj b/csharp/4-Stack/testCases/testCases.csproj new file mode 100644 index 000000000..04bdaa75b --- /dev/null +++ b/csharp/4-Stack/testCases/testCases.csproj @@ -0,0 +1,19 @@ + + + + net6.0 + enable + + false + + + + + + + + + + + + From c6bc4a7c4b2e32e1097ce42b304f3d30a9d35041 Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Mon, 9 May 2022 23:55:58 +0200 Subject: [PATCH 23/94] CHORE : do not produce ref assembly anywhere --- csharp/2-TwoPointers/main/main.csproj | 1 + .../2-TwoPointers/testCases/testCases.csproj | 28 +++++++++--------- csharp/3-SlidingWindow/main/main.csproj | 1 + .../testCases/testCases.csproj | 28 +++++++++--------- csharp/4-Stack/main/main.csproj | 1 + csharp/4-Stack/testCases/testCases.csproj | 29 ++++++++++--------- 6 files changed, 46 insertions(+), 42 deletions(-) diff --git a/csharp/2-TwoPointers/main/main.csproj b/csharp/2-TwoPointers/main/main.csproj index 74abf5c97..937ea0c93 100644 --- a/csharp/2-TwoPointers/main/main.csproj +++ b/csharp/2-TwoPointers/main/main.csproj @@ -5,6 +5,7 @@ net6.0 enable enable + false diff --git a/csharp/2-TwoPointers/testCases/testCases.csproj b/csharp/2-TwoPointers/testCases/testCases.csproj index 923ca5701..d0b71fa42 100644 --- a/csharp/2-TwoPointers/testCases/testCases.csproj +++ b/csharp/2-TwoPointers/testCases/testCases.csproj @@ -1,19 +1,19 @@ - - net6.0 - enable + + net6.0 + enable + false + false + - false - - - - - - - - - - + + + + + + + + diff --git a/csharp/3-SlidingWindow/main/main.csproj b/csharp/3-SlidingWindow/main/main.csproj index 74abf5c97..937ea0c93 100644 --- a/csharp/3-SlidingWindow/main/main.csproj +++ b/csharp/3-SlidingWindow/main/main.csproj @@ -5,6 +5,7 @@ net6.0 enable enable + false diff --git a/csharp/3-SlidingWindow/testCases/testCases.csproj b/csharp/3-SlidingWindow/testCases/testCases.csproj index 2af991855..d0b71fa42 100644 --- a/csharp/3-SlidingWindow/testCases/testCases.csproj +++ b/csharp/3-SlidingWindow/testCases/testCases.csproj @@ -1,19 +1,19 @@ - - net6.0 - enable + + net6.0 + enable + false + false + - false - - - - - - - - - - + + + + + + + + diff --git a/csharp/4-Stack/main/main.csproj b/csharp/4-Stack/main/main.csproj index 40c60dd4c..fd0732058 100644 --- a/csharp/4-Stack/main/main.csproj +++ b/csharp/4-Stack/main/main.csproj @@ -5,6 +5,7 @@ net6.0 enable enable + false diff --git a/csharp/4-Stack/testCases/testCases.csproj b/csharp/4-Stack/testCases/testCases.csproj index 04bdaa75b..7cb59206c 100644 --- a/csharp/4-Stack/testCases/testCases.csproj +++ b/csharp/4-Stack/testCases/testCases.csproj @@ -1,19 +1,20 @@ - - net6.0 - enable + + net6.0 + enable + + false + false + - false - - - - - - - - - - + + + + + + + + From 51571d244241f82e20c8e262b8dc1b74e2915be3 Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Mon, 9 May 2022 23:56:34 +0200 Subject: [PATCH 24/94] DOC : adds readme --- csharp/readme.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 csharp/readme.md diff --git a/csharp/readme.md b/csharp/readme.md new file mode 100644 index 000000000..3e3442023 --- /dev/null +++ b/csharp/readme.md @@ -0,0 +1,9 @@ +# README + +1. On OSX test debugger won't work unless you add + +```xml +false +``` + +in each *.csproj file. \ No newline at end of file From d0081b9a3bcea004dc048431e1b41fcb7b535c2f Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Mon, 9 May 2022 23:57:04 +0200 Subject: [PATCH 25/94] FEAT : solves L20 --- .../main/N1-L20-ValidParentheses/Solution.cs | 29 +++++++++++++++- .../testCases/N1-L20-ValidParentheses_Test.cs | 33 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/csharp/4-Stack/main/N1-L20-ValidParentheses/Solution.cs b/csharp/4-Stack/main/N1-L20-ValidParentheses/Solution.cs index e79b6da8d..30a68dd76 100644 --- a/csharp/4-Stack/main/N1-L20-ValidParentheses/Solution.cs +++ b/csharp/4-Stack/main/N1-L20-ValidParentheses/Solution.cs @@ -2,9 +2,36 @@ namespace Stack.Main.ValidParentheses { public class Solution { + // time complexity : O(n) <-- string is traversed only once + // space complexity : O(n) <-- max size of the stack public bool IsValid(string s) { - return false; + + if (s.Length %2 != 0) + return false; + + Stack stack = new(); + Dictionary closeOpenBracketsMatch = new() + { + {')','('}, + {']','['}, + {'}','{'} + }; + + foreach (char c in s) + { + if (closeOpenBracketsMatch.ContainsKey(c)) + { + if (stack.Count != 0 && stack.Peek() == closeOpenBracketsMatch[c]) + stack.Pop(); + else + return false; + } + else + stack.Push(c); + } + + return stack.Count == 0 ? true : false; } } diff --git a/csharp/4-Stack/testCases/N1-L20-ValidParentheses_Test.cs b/csharp/4-Stack/testCases/N1-L20-ValidParentheses_Test.cs index 7601c3ef9..f2e201339 100644 --- a/csharp/4-Stack/testCases/N1-L20-ValidParentheses_Test.cs +++ b/csharp/4-Stack/testCases/N1-L20-ValidParentheses_Test.cs @@ -17,4 +17,37 @@ public void Test_Example_1() testResult.Should().Be(true); } + + [Test] + public void Test_Example_2() + { + string input = "()[]{}"; + + Solution solution = new(); + bool testResult = solution.IsValid(input); + + testResult.Should().Be(true); + } + + [Test] + public void Test_Example_3() + { + string input = "(]"; + + Solution solution = new(); + bool testResult = solution.IsValid(input); + + testResult.Should().Be(false); + } + + [Test] + public void Test_Example_4() + { + string input = "{[()]}"; + + Solution solution = new(); + bool testResult = solution.IsValid(input); + + testResult.Should().Be(true); + } } \ No newline at end of file From 2b4c1f31177262073a725fc6ef3a8ac888a72dd6 Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Wed, 11 May 2022 23:25:19 +0200 Subject: [PATCH 26/94] FEAT: solves MinStack, v1 --- .gitignore | 2 +- .../4-Stack/main/N2-L155-MinStack/Solution.cs | 48 +++++++++++++++++++ .../4-Stack/main/N2-L155-MinStack/readme.md | 29 +++++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 csharp/4-Stack/main/N2-L155-MinStack/Solution.cs create mode 100644 csharp/4-Stack/main/N2-L155-MinStack/readme.md diff --git a/.gitignore b/.gitignore index 882195282..e270acdd0 100644 --- a/.gitignore +++ b/.gitignore @@ -132,4 +132,4 @@ $RECYCLE.BIN/ _NCrunch* .vscode/launch.json -.vscode/tasks.json +.vscode/tasks.json \ No newline at end of file diff --git a/csharp/4-Stack/main/N2-L155-MinStack/Solution.cs b/csharp/4-Stack/main/N2-L155-MinStack/Solution.cs new file mode 100644 index 000000000..00479335c --- /dev/null +++ b/csharp/4-Stack/main/N2-L155-MinStack/Solution.cs @@ -0,0 +1,48 @@ +namespace Stack.Main.MinStack +{ + public class MinStack + { + private Stack _stack ; + + private Stack _minStack; + public MinStack() + { + _stack = new(); + _minStack = new(); + } + + public void Push(int val) + { + _stack.Push(val); + if (_minStack.TryPeek(out int currentMin)) + _minStack.Push(Math.Min(val,currentMin)); + else{ _minStack.Push(val);} + + } + + public void Pop() + { + _stack.Pop(); + _minStack.Pop(); + } + + public int Top() + { + return _stack.Peek(); + } + + public int GetMin() + { + return _minStack.Peek(); + } + } + + /** + * Your MinStack object will be instantiated and called as such: + * MinStack obj = new MinStack(); + * obj.Push(val); + * obj.Pop(); + * int param_3 = obj.Top(); + * int param_4 = obj.GetMin(); + */ +} \ No newline at end of file diff --git a/csharp/4-Stack/main/N2-L155-MinStack/readme.md b/csharp/4-Stack/main/N2-L155-MinStack/readme.md new file mode 100644 index 000000000..60b129426 --- /dev/null +++ b/csharp/4-Stack/main/N2-L155-MinStack/readme.md @@ -0,0 +1,29 @@ +# N2-L155. MinStack +Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. + +Implement the MinStack class: + + MinStack() initializes the stack object. + void push(int val) pushes the element val onto the stack. + void pop() removes the element on the top of the stack. + int top() gets the top element of the stack. + int getMin() retrieves the minimum element in the stack. + +## Example 1: + +### Input +["MinStack","push","push","push","getMin","pop","top","getMin"] +[[], [-2], [0], [-3], [], [], [], []] + +### Output +[null,null,null,null,-3,null,0,-2] + +### Explanation +MinStack minStack = new MinStack(); +minStack.push(-2); +minStack.push(0); +minStack.push(-3); +minStack.getMin(); // return -3 +minStack.pop(); +minStack.top(); // return 0 +minStack.getMin(); // return -2 From 6615a23c2046cb7bea5785ed678c2e78529bbd3f Mon Sep 17 00:00:00 2001 From: Stefano Colucci Date: Sat, 14 May 2022 18:48:30 +0200 Subject: [PATCH 27/94] N704 - Binary Search --- .vscode/tasks.json | 41 ------------------- csharp/5-BinarySearch/build.proj | 5 +++ .../main/N1-L704-BinarySearch/Solution.cs | 28 +++++++++++++ .../main/N1-L704-BinarySearch/readme.md | 30 ++++++++++++++ csharp/5-BinarySearch/main/Program.cs | 2 + csharp/5-BinarySearch/main/main.csproj | 11 +++++ .../testCases/N1-L704-BinarySearch.cs | 33 +++++++++++++++ .../5-BinarySearch/testCases/testCases.csproj | 19 +++++++++ 8 files changed, 128 insertions(+), 41 deletions(-) delete mode 100644 .vscode/tasks.json create mode 100644 csharp/5-BinarySearch/build.proj create mode 100644 csharp/5-BinarySearch/main/N1-L704-BinarySearch/Solution.cs create mode 100644 csharp/5-BinarySearch/main/N1-L704-BinarySearch/readme.md create mode 100644 csharp/5-BinarySearch/main/Program.cs create mode 100644 csharp/5-BinarySearch/main/main.csproj create mode 100644 csharp/5-BinarySearch/testCases/N1-L704-BinarySearch.cs create mode 100644 csharp/5-BinarySearch/testCases/testCases.csproj diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 105dc04aa..000000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "build", - "command": "dotnet", - "type": "process", - "args": [ - "build", - "${workspaceFolder}/csharp/ArraysAndHashing/build.proj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "publish", - "command": "dotnet", - "type": "process", - "args": [ - "publish", - "${workspaceFolder}/csharp/ArraysAndHashing/ArraysAndHashing.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile" - }, - { - "label": "watch", - "command": "dotnet", - "type": "process", - "args": [ - "watch", - "run", - "--project", - "${workspaceFolder}/csharp/ArraysAndHashing/ArraysAndHashing.csproj" - ], - "problemMatcher": "$msCompile" - } - ] -} \ No newline at end of file diff --git a/csharp/5-BinarySearch/build.proj b/csharp/5-BinarySearch/build.proj new file mode 100644 index 000000000..f63ef53ad --- /dev/null +++ b/csharp/5-BinarySearch/build.proj @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/csharp/5-BinarySearch/main/N1-L704-BinarySearch/Solution.cs b/csharp/5-BinarySearch/main/N1-L704-BinarySearch/Solution.cs new file mode 100644 index 000000000..81f9f3d45 --- /dev/null +++ b/csharp/5-BinarySearch/main/N1-L704-BinarySearch/Solution.cs @@ -0,0 +1,28 @@ +namespace BinarySearch.Main.BinarySearch +{ + public class Solution + { + public int Search(int[] nums, int target) + { + int leftPt = 0; + int rightPt = nums.Length - 1; + + while (leftPt <= rightPt) + { + // use this definition instead of + // (rightPt + leftPt) / 2 + // to avoid overflow + int indexAtHalf = leftPt + ((rightPt - leftPt) / 2); + + if (target > nums[indexAtHalf]) + leftPt = indexAtHalf + 1; + else if (target < nums[indexAtHalf]) + rightPt = indexAtHalf - 1; + else + return indexAtHalf; + } + + return -1; + } + } +} \ No newline at end of file diff --git a/csharp/5-BinarySearch/main/N1-L704-BinarySearch/readme.md b/csharp/5-BinarySearch/main/N1-L704-BinarySearch/readme.md new file mode 100644 index 000000000..677a94845 --- /dev/null +++ b/csharp/5-BinarySearch/main/N1-L704-BinarySearch/readme.md @@ -0,0 +1,30 @@ +# N1-L7704. Binary Search +Easy + +Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. +If target exists, then return its index. Otherwise, return -1. + +You must write an algorithm with **O(log n) runtime complexity** + + + +## Example 1: + +Input: nums = [-1,0,3,5,9,12], target = 9 +Output: 4 +Explanation: 9 exists in nums and its index is 4 + +## Example 2: + +Input: nums = [-1,0,3,5,9,12], target = 2 +Output: -1 +Explanation: 2 does not exist in nums so return -1 + + +## Constraints: + + 1 <= nums.length <= 104 + -104 < nums[i], target < 104 + All the integers in nums are unique. + nums is sorted in ascending order. + diff --git a/csharp/5-BinarySearch/main/Program.cs b/csharp/5-BinarySearch/main/Program.cs new file mode 100644 index 000000000..3751555cb --- /dev/null +++ b/csharp/5-BinarySearch/main/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/csharp/5-BinarySearch/main/main.csproj b/csharp/5-BinarySearch/main/main.csproj new file mode 100644 index 000000000..937ea0c93 --- /dev/null +++ b/csharp/5-BinarySearch/main/main.csproj @@ -0,0 +1,11 @@ + + + + Exe + net6.0 + enable + enable + false + + + diff --git a/csharp/5-BinarySearch/testCases/N1-L704-BinarySearch.cs b/csharp/5-BinarySearch/testCases/N1-L704-BinarySearch.cs new file mode 100644 index 000000000..e09435715 --- /dev/null +++ b/csharp/5-BinarySearch/testCases/N1-L704-BinarySearch.cs @@ -0,0 +1,33 @@ +using NUnit.Framework; +using BinarySearch.Main.BinarySearch; +using FluentAssertions; + +namespace testCases; + +public class BinarySearch_Test +{ + + [Test] + public void Test_Example_1() + { + int[] inputNums = {-1, 0, 3, 5, 9, 12}; + int target = 9; + + Solution solution = new(); + int testResult = solution.Search(inputNums,target); + + testResult.Should().Be(4); + } + + [Test] + public void Test_Example_2() + { + int[] inputNums = { -1, 0, 3, 5, 9, 12 }; + int target = 2; + + Solution solution = new(); + int testResult = solution.Search(inputNums, target); + + testResult.Should().Be(-1); + } +} \ No newline at end of file diff --git a/csharp/5-BinarySearch/testCases/testCases.csproj b/csharp/5-BinarySearch/testCases/testCases.csproj new file mode 100644 index 000000000..a3d997bcc --- /dev/null +++ b/csharp/5-BinarySearch/testCases/testCases.csproj @@ -0,0 +1,19 @@ + + + + net6.0 + enable + false + false + + + + + + + + + + + + From 2d2e197f0c8695ee9fd222f9a1b8986fd008a246 Mon Sep 17 00:00:00 2001 From: Stefano Colucci Date: Mon, 16 May 2022 13:38:47 +0200 Subject: [PATCH 28/94] FEAT : set up L206 --- csharp/5-LinkedList/build.proj | 5 ++++ .../N1-L206-ReverseLinkedList/Solution.cs | 18 ++++++++++++ .../main/N1-L206-ReverseLinkedList/readme.md | 27 ++++++++++++++++++ .../N1-L206-ReverseLinkedList/rev1ex1.jpg | Bin 0 -> 19131 bytes .../N1-L206-ReverseLinkedList/rev1ex2.jpg | Bin 0 -> 7808 bytes csharp/5-LinkedList/main/Program.cs | 2 ++ csharp/5-LinkedList/main/main.csproj | 11 +++++++ .../N1-L206-ReverseLinkedList_Test.cs | 14 +++++++++ .../5-LinkedList/testCases/testCases.csproj | 19 ++++++++++++ 9 files changed, 96 insertions(+) create mode 100644 csharp/5-LinkedList/build.proj create mode 100644 csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/Solution.cs create mode 100644 csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/readme.md create mode 100644 csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/rev1ex1.jpg create mode 100644 csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/rev1ex2.jpg create mode 100644 csharp/5-LinkedList/main/Program.cs create mode 100644 csharp/5-LinkedList/main/main.csproj create mode 100644 csharp/5-LinkedList/testCases/N1-L206-ReverseLinkedList_Test.cs create mode 100644 csharp/5-LinkedList/testCases/testCases.csproj diff --git a/csharp/5-LinkedList/build.proj b/csharp/5-LinkedList/build.proj new file mode 100644 index 000000000..878e3e65f --- /dev/null +++ b/csharp/5-LinkedList/build.proj @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/Solution.cs b/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/Solution.cs new file mode 100644 index 000000000..f2eaf324d --- /dev/null +++ b/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/Solution.cs @@ -0,0 +1,18 @@ + +// Definition for singly-linked list. +public class ListNode { + public int val; + public ListNode next; + public ListNode(int val=0, ListNode next=null) { + this.val = val; + this.next = next; + } +} + +public class Solution +{ + public ListNode ReverseList(ListNode head) + { + return new(); + } +} \ No newline at end of file diff --git a/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/readme.md b/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/readme.md new file mode 100644 index 000000000..7e4cc25ee --- /dev/null +++ b/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/readme.md @@ -0,0 +1,27 @@ +# N1-L206. ReverseLinkedList + +Given the head of a singly linked list, reverse the list, and return the reversed list. + +## Example 1: + +![img1](./rev1ex1.jpg) + +Input: head = [1,2,3,4,5] +Output: [5,4,3,2,1] + +## Example 2: + +![img2](./rev1ex2.jpg) + +Input: head = [1,2] +Output: [2,1] + +## Example 3: + +Input: head = [] +Output: [] + +## Constraints: + + The number of nodes in the list is the range [0, 5000]. + -5000 <= Node.val <= 5000 diff --git a/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/rev1ex1.jpg b/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/rev1ex1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..697bf935de736809477d5abd7a37c69726717c98 GIT binary patch literal 19131 zcmeIZ2UJsCxAz;G^eUjzk_nLFAwSMbr;%W{+1$wIb z6o7*R0N`A|09ROm5&#ePkMhSm-gUvhf&WJ#x^aWx1~Cx{2{92dF$ozZ83`!`DKRlQ zH8}+(6%{oV2^q~z8mgPu$5elu1m};Ic=$xu4XH?pNv~`FX1QtxP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VHwDmZm9X@WH4B>8|x0E(rwpHI1y z6;1u$M1-#C1qqLiEi_Tc)Q7S0#7s4Gz{*?U+2?S6Zw{N&HOyO<<+>Rs8;$!XN>_kE zCSpn`>|S1sq9w?X<|RkqKR_WjhX1cYA^zvKe~oW;C+Fdq`8OfXceL4tW~Me5889zv zMN7v%ooNU><5S#2KCxWoQi#a_*o#aoBHO+P(9LJF0cd>oZxQhKZrn;fZNMSoP#i}W-iJjoIv2BUx8$bUC51Msw`LF%&W2u^w)ThV$5m-yC;OLm^uM~X0 z$0G)d?^_?79{nIal35HIg@myMUG5YqS43AM+w7g*dwiVUsCu=#W^HeDUr#`7)k8rOd;Z~VpSMUEEPsL19CwHsI#pTX(m}*?DN1mR$T&iXbP2VJPBRmBd^pq5CbcsxvH4Cj z)Q6Osi?P#kU3*hoCI2BiG-8>Zdp2=n9P@@F=7mIc2}!%408{{_a*eE0!*@ed6+KnX z!S<@M-M|c0k#@&(C{7pK!fieI8{L*DkvkDLZt_|u$H}&E%z~Z$@)A^mKTSFauO|O5 D_}Oae literal 0 HcmV?d00001 diff --git a/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/rev1ex2.jpg b/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/rev1ex2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a50261a971ebb788cce7c8ca556d624923efd1bc GIT binary patch literal 7808 zcmdUUXHZmKv+j@?az+G+Ll_VcBu4=y4B)_!hoGRKgdq$$il8JV51@o04nYI~VaPd2 zQUoLoNphB)!^L~PbLu@mzEk)7yuF{=)zxdQ?yl-pySkr!J$^k0pn<4ssRQuv006w3 z2XKu8r~wG@|H|Jt!Hp0S6aE!aVqzj%2Jkm7K0Xl%2@v>q4<0@NA%KXOgp`(!i(U-Kz^$Us$b3uO z+HHtOM%BbLF^Ngb#`A5&*QzcSUI~L|NUxBJM>mcb{u$su0{ykp{v+(atdjr=f}4zJ z31|VzfWyaCOuwZcVayR*Ety|QsG`TyrC*S@V&c#jN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M!z8b44O6{y^Hz%r4GW%&V~;7ixTw zFRpeA?Qjhc#vxB`%9+V%)#naagAC^OCUqk*RCV*^cVI&ZxzW!`RwSQprL$fpzwp#Z zNF15$PK*`?2^Wy?zs-6}1r0hBpOSF&l!sUL)vc=6;oR@ijZXO3)Fll6Xe0`T3Piic zDA)ivxybRrK=#1ZyHO?|X#*uk{UvIdEH)nSNh;C5P06U79Xb~g@I{52swOD4L1&+s zqCWzCFVFZ`F>s1L6Z5DGnY}%>;2e2}V@7N{*-gQ+Rn|QIJ(u^cO4(q~^3U_HUK`cs zxjzrS%jYO%ud}(Gl8j%!iMvrbWUUzz}Z;5%pzbVDv?8G0TrxN^c_9WO_b_yt8Py8PW CJ(TzW literal 0 HcmV?d00001 diff --git a/csharp/5-LinkedList/main/Program.cs b/csharp/5-LinkedList/main/Program.cs new file mode 100644 index 000000000..3751555cb --- /dev/null +++ b/csharp/5-LinkedList/main/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/csharp/5-LinkedList/main/main.csproj b/csharp/5-LinkedList/main/main.csproj new file mode 100644 index 000000000..560a5c18d --- /dev/null +++ b/csharp/5-LinkedList/main/main.csproj @@ -0,0 +1,11 @@ + + + + Exe + net6.0 + enable + enable + false + + + \ No newline at end of file diff --git a/csharp/5-LinkedList/testCases/N1-L206-ReverseLinkedList_Test.cs b/csharp/5-LinkedList/testCases/N1-L206-ReverseLinkedList_Test.cs new file mode 100644 index 000000000..e721e912d --- /dev/null +++ b/csharp/5-LinkedList/testCases/N1-L206-ReverseLinkedList_Test.cs @@ -0,0 +1,14 @@ +using NUnit.Framework; + +namespace testCases +{ + public class ReverseLinkedList_Test + { + [Test] + public void Test_Example_1() + { + ListNode input = new(); + } + } +} + diff --git a/csharp/5-LinkedList/testCases/testCases.csproj b/csharp/5-LinkedList/testCases/testCases.csproj new file mode 100644 index 000000000..485462039 --- /dev/null +++ b/csharp/5-LinkedList/testCases/testCases.csproj @@ -0,0 +1,19 @@ + + + + net6.0 + enable + false + false + + + + + + + + + + + + \ No newline at end of file From c3f895319785ee15ff822ccd2e00886b3486e192 Mon Sep 17 00:00:00 2001 From: Stefano Colucci Date: Mon, 16 May 2022 14:26:42 +0200 Subject: [PATCH 29/94] L206 : solves iteratively and recursively --- .../N1-L206-ReverseLinkedList/Solution.cs | 51 ++++++++++++++++--- .../N1-L206-ReverseLinkedList_Test.cs | 36 ++++++++++++- 2 files changed, 78 insertions(+), 9 deletions(-) diff --git a/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/Solution.cs b/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/Solution.cs index f2eaf324d..40b9d7ec8 100644 --- a/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/Solution.cs +++ b/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/Solution.cs @@ -1,18 +1,53 @@ // Definition for singly-linked list. -public class ListNode { - public int val; - public ListNode next; - public ListNode(int val=0, ListNode next=null) { - this.val = val; - this.next = next; - } +public class ListNode +{ + public int val; + public ListNode next; + public ListNode(int val = 0, ListNode next = null) + { + this.val = val; + this.next = next; + } } public class Solution { + // Iterative + // TC : O(n) + // SC : O(1) + public ListNode ReverseListIteratively(ListNode head) + { + ListNode previous = null; + ListNode current = head; + + while (current is not null) + { + ListNode next = current.next; + current.next = previous; + previous = current; + current = next; + } + + return previous; + } + + // recursive + // TC : O(n) + // SC : O(n), public ListNode ReverseList(ListNode head) { - return new(); + if (head is null) + return head; + + ListNode newHead = head; + if (head.next is not null) + { + newHead = ReverseList(head.next); + head.next.next = head; + } + head.next = null; + + return newHead; } } \ No newline at end of file diff --git a/csharp/5-LinkedList/testCases/N1-L206-ReverseLinkedList_Test.cs b/csharp/5-LinkedList/testCases/N1-L206-ReverseLinkedList_Test.cs index e721e912d..1893955f7 100644 --- a/csharp/5-LinkedList/testCases/N1-L206-ReverseLinkedList_Test.cs +++ b/csharp/5-LinkedList/testCases/N1-L206-ReverseLinkedList_Test.cs @@ -1,3 +1,4 @@ +using FluentAssertions; using NUnit.Framework; namespace testCases @@ -7,7 +8,40 @@ public class ReverseLinkedList_Test [Test] public void Test_Example_1() { - ListNode input = new(); + ListNode input = new(1, new(2, new(3, new(4, new(5))))); + + Solution solution = new(); + ListNode testResult = solution.ReverseList(input); + + testResult.val.Should().Be(5); + testResult.next.val.Should().Be(4); + testResult.next.next.val.Should().Be(3); + testResult.next.next.next.val.Should().Be(2); + testResult.next.next.next.next.val.Should().Be(1); + + } + + [Test] + public void Test_Example_2() + { + ListNode input = new(1, new(2)); + + Solution solution = new(); + ListNode testResult = solution.ReverseList(input); + + testResult.val.Should().Be(2); + testResult.next.val.Should().Be(1); + } + + [Test] + public void Test_Example_3() + { + ListNode input = null; + + Solution solution = new(); + ListNode testResult = solution.ReverseList(input); + + testResult.Should().BeNull(); } } } From 4a493a0e861a5ccdc0b5917fc72f3bfd4d342347 Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Mon, 16 May 2022 20:01:36 +0200 Subject: [PATCH 30/94] FEAT : update solution --- csharp/4-Stack/main/N2-L155-MinStack/Solution.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/csharp/4-Stack/main/N2-L155-MinStack/Solution.cs b/csharp/4-Stack/main/N2-L155-MinStack/Solution.cs index 00479335c..9f9084248 100644 --- a/csharp/4-Stack/main/N2-L155-MinStack/Solution.cs +++ b/csharp/4-Stack/main/N2-L155-MinStack/Solution.cs @@ -1,5 +1,8 @@ namespace Stack.Main.MinStack { + // All operations in this class are O(1) in time, + // thanks to the Stack capabilities. + // That's why we add a second one for the minima public class MinStack { private Stack _stack ; @@ -14,10 +17,8 @@ public MinStack() public void Push(int val) { _stack.Push(val); - if (_minStack.TryPeek(out int currentMin)) - _minStack.Push(Math.Min(val,currentMin)); - else{ _minStack.Push(val);} - + val = _minStack.TryPeek(out int currentMin) ? Math.Min(val,currentMin) : val; + _minStack.Push(val); } public void Pop() From ba1fb6668674bd6ae585b000dd7ef2da52c227c6 Mon Sep 17 00:00:00 2001 From: TaetoTum Date: Thu, 19 May 2022 22:32:53 +0200 Subject: [PATCH 31/94] FEAT : set up L21 --- .../N1-L206-ReverseLinkedList/Solution.cs | 84 +++++++++--------- .../N2-L21-MergedTwoSortedListed/Solution.cs | 34 +++++++ .../N2-L21-MergedTwoSortedListed/img1.png | Bin 0 -> 369329 bytes .../N2-L21-MergedTwoSortedListed/readme.md | 33 +++++++ .../N1-L206-ReverseLinkedList_Test.cs | 1 + .../testCases/N2-L21-MergeTwoLists_Test.cs | 52 +++++++++++ 6 files changed, 163 insertions(+), 41 deletions(-) create mode 100644 csharp/5-LinkedList/main/N2-L21-MergedTwoSortedListed/Solution.cs create mode 100644 csharp/5-LinkedList/main/N2-L21-MergedTwoSortedListed/img1.png create mode 100644 csharp/5-LinkedList/main/N2-L21-MergedTwoSortedListed/readme.md create mode 100644 csharp/5-LinkedList/testCases/N2-L21-MergeTwoLists_Test.cs diff --git a/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/Solution.cs b/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/Solution.cs index 40b9d7ec8..6abbcb0e3 100644 --- a/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/Solution.cs +++ b/csharp/5-LinkedList/main/N1-L206-ReverseLinkedList/Solution.cs @@ -1,53 +1,55 @@ - -// Definition for singly-linked list. -public class ListNode +namespace LinkedList.Main.ReverseList { - public int val; - public ListNode next; - public ListNode(int val = 0, ListNode next = null) + // Definition for singly-linked list. + public class ListNode { - this.val = val; - this.next = next; + public int val; + public ListNode next; + public ListNode(int val = 0, ListNode next = null) + { + this.val = val; + this.next = next; + } } -} -public class Solution -{ - // Iterative - // TC : O(n) - // SC : O(1) - public ListNode ReverseListIteratively(ListNode head) + public class Solution { - ListNode previous = null; - ListNode current = head; - - while (current is not null) + // Iterative + // TC : O(n) + // SC : O(1) + public ListNode ReverseListIteratively(ListNode head) { - ListNode next = current.next; - current.next = previous; - previous = current; - current = next; - } + ListNode previous = null; + ListNode current = head; - return previous; - } + while (current is not null) + { + ListNode next = current.next; + current.next = previous; + previous = current; + current = next; + } - // recursive - // TC : O(n) - // SC : O(n), - public ListNode ReverseList(ListNode head) - { - if (head is null) - return head; + return previous; + } - ListNode newHead = head; - if (head.next is not null) + // recursive + // TC : O(n) + // SC : O(n), + public ListNode ReverseList(ListNode head) { - newHead = ReverseList(head.next); - head.next.next = head; - } - head.next = null; + if (head is null) + return head; - return newHead; + ListNode newHead = head; + if (head.next is not null) + { + newHead = ReverseList(head.next); + head.next.next = head; + } + head.next = null; + + return newHead; + } } -} \ No newline at end of file +} diff --git a/csharp/5-LinkedList/main/N2-L21-MergedTwoSortedListed/Solution.cs b/csharp/5-LinkedList/main/N2-L21-MergedTwoSortedListed/Solution.cs new file mode 100644 index 000000000..7bca9fc3a --- /dev/null +++ b/csharp/5-LinkedList/main/N2-L21-MergedTwoSortedListed/Solution.cs @@ -0,0 +1,34 @@ +/** + * Definition for singly-linked list. + * public class ListNode { + * public int val; + * public ListNode next; + * public ListNode(int val=0, ListNode next=null) { + * this.val = val; + * this.next = next; + * } + * } + */ + +namespace LinkedList.Main.MergeTwoLists +{ + // Definition for singly-linked list. + public class ListNode + { + public int val; + public ListNode next; + public ListNode(int val = 0, ListNode next = null) + { + this.val = val; + this.next = next; + } + } + public class Solution + { + + public ListNode MergeTwoLists(ListNode list1, ListNode list2) + { + return new(); + } + } +} diff --git a/csharp/5-LinkedList/main/N2-L21-MergedTwoSortedListed/img1.png b/csharp/5-LinkedList/main/N2-L21-MergedTwoSortedListed/img1.png new file mode 100644 index 0000000000000000000000000000000000000000..2406ab55781e6cadd5a61550f6296d20432e860f GIT binary patch literal 369329 zcma&N1z23mvM>q+cemg^xC999!EJDN2<`-TcNyH>2Djku8r*{h4ek)~$iC<9eg60E z`R`lb*VDbayQ;dYyH;0K*F-2ONTMJTB0@kwph!!J10f(_=pZ1VY~W$vYF>ZKdqY4V zD_V+)DM^coktsR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