Git Product home page Git Product logo

leetcode's Introduction

../Dynamic-programming
|-- Bitmask
|   |-- 1434._Number_of_Ways_to_Wear_Different_Hats_to_Each_Other.md
|   `-- README.md
|-- One-dimension
|   |-- 120._Triangle.md
|   |-- 139._Word_Break.md
|   |-- 140._Word_Break_II.md
|   |-- 152._Maximum_Product_Subarray.md
|   |-- 198._House_Robber.md
|   |-- 264._Ugly_Number_II.md
|   |-- 279._Perfect_Squares.md
|   |-- 309._Best_Time_to_Buy_and_Sell_Stock_with_Cooldown.md
|   |-- 32._Longest_Valid_Parentheses.md
|   |-- 338._Counting_Bits.md
|   |-- 343._Integer_Break.md
|   |-- 357._Count_Numbers_with_Unique_Digits.md
|   |-- 413._Arithmetic_Slices.md
|   |-- 472._Concatenated_Words.md
|   |-- 64._Minimum_Path_Sum.md
|   |-- 70._Climbing_Stairs.md
|   |-- 894._All_Possible_Full_Binary_Trees.md
|   |-- 91._Decode_Ways.md
|   |-- 96._Unique_Binary_Search_Trees.md
|   `-- README.md
|-- README.md
|-- Three-dimension
|   |-- 1463._Cherry_Pickup_II.md
|   |-- 1473._Paint_House_III.md
|   `-- README.md
`-- Two-dimension
    |-- 10._Regular_Expression_Matching.md
    |-- 1130._Minimum_Cost_Tree_From_Leaf_Values.md
    |-- 1140._Stone_Game_II.md
    |-- 115._Distinct_Subsequences.md
    |-- 1548._The_Most_Similar_Path_in_a_Graph.md
    |-- 188._Best_Time_to_Buy_and_Sell_Stock_IV.md
    |-- 221._Maximal_Square.md
    |-- 312._Burst_Balloons.md
    |-- 375._Guess_Number_Higher_or_Lower_II.md
    |-- 410._Split_Array_Largest_Sum.md
    |-- 44._Wildcard_Matching.md
    |-- 5._Longest_Palindromic_Substring.md
    |-- 562._Longest_Line_of_Consecutive_One_in_Matrix.md
    |-- 72._Edit_Distance.md
    |-- 727._Minimum_Window_Subsequence.md
    |-- 730._Count_Different_Palindromic_Subsequences.md
    |-- 87._Scramble_String.md
    |-- 95._Unique_Binary_Search_Trees_II.md
    |-- 97._Interleaving_String.md
    `-- README.md

4 directories, 46 files
../Graph
|-- 1059._All_Paths_from_Source_Lead_to_Destination.md
|-- 310._Minimum_Height_Trees.md
|-- 684._Redundant_Connection.md
|-- 685._Redundant_Connection_II.md
|-- Cycle-Detection
|   `-- README.md
|-- Dijkstra_Bellman-Ford
|   |-- 1514._Path_with_Maximum_Probability.md
|   |-- 743._Network_Delay_Time.md
|   `-- README.md
|-- Euler-path
|   |-- 332._Reconstruct_Itinerary.md
|   `-- README.md
|-- Floydâ\200\223Warshall
|   |-- 399._Evaluate_Division.md
|   `-- README.md
|-- Minimal-Spinning-Tree
|   `-- README.md
|-- README.md
|-- Tarjan's-algorithm
|   |-- 1192._Critical_Connections_in_a_Network.md
|   `-- README.md
`-- Topologic-sort
    |-- 1048._Longest_String_Chain.md
    |-- 1203._Sort_Items_by_Groups_Respecting_Dependencies.md
    |-- 207._Course_Schedule.md
    |-- 210._Course_Schedule_II.md
    |-- 329._Longest_Increasing_Path_in_a_Matrix.md
    |-- 802._Find_Eventual_Safe_States.md
    `-- README.md

7 directories, 23 files
../List
|-- Binary-search
|   |-- 1060._Missing_Element_in_Sorted_Array.md
|   |-- 1146._Snapshot_Array.md
|   |-- 1231._Divide_Chocolate.md
|   |-- 240._Search_a_2D_Matrix_II.md
|   |-- 327._Count_of_Range_Sum.md
|   |-- 4._Median_of_Two_Sorted_Arrays.md
|   |-- 410._Split_Array_Largest_Sum.md
|   |-- 5455._Minimum_Number_of_Days_to_Make_m_Bouquets.md
|   |-- 635._Design_Log_Storage_System.md
|   `-- README.md
|-- Heap-sort-Priority-Queue
|   |-- 1383._Maximum_Performance_of_a_Team.md
|   |-- 215._Kth_Largest_Element_in_an_Array.md
|   |-- 632._Smallest_Range_Covering_Elements_from_K_Lists.md
|   |-- 857._Minimum_Cost_to_Hire_K_Workers.md
|   |-- 973._K_Closest_Points_to_Origin.md
|   `-- README.md
|-- I-do-not-know....
|   |-- 443._String_Compression.md
|   |-- 686._Repeated_String_Match.md
|   `-- README.md
|-- KMP
|   |-- 214._Shortest_Palindrome.md
|   `-- README.md
|-- Math
|   |-- 899._Orderly_Queue.md
|   `-- README.md
|-- Palindromic
|   |-- 336._Palindrome_Pairs.md
|   |-- 5._Longest_Palindromic_Substring.md
|   |-- 647._Palindromic_Substrings.md
|   `-- README.md
|-- Pure-programming
|   |-- 1096._Brace_Expansion_II.md
|   |-- 1156._Swap_For_Longest_Repeated_Character_Substring.md
|   |-- 1163._Last_Substring_in_Lexicographical_Order.md
|   |-- 1181._Before_and_After_Puzzle.md
|   |-- 1247._Minimum_Swaps_to_Make_Strings_Equal.md
|   |-- 146._LRU_Cache.md
|   |-- 157._Read_N_Characters_Given_Read4.md
|   |-- 158._Read_N_Characters_Given_Read4_II___Call_multiple_times.md
|   |-- 161._One_Edit_Distance.md
|   |-- 186._Reverse_Words_in_a_String_II.md
|   |-- 2._Add_Two_Numbers.md
|   |-- 249._Group_Shifted_Strings.md
|   |-- 271._Encode_and_Decode_Strings.md
|   |-- 30._Substring_with_Concatenation_of_All_Words.md
|   |-- 316._Remove_Duplicate_Letters.md
|   |-- 415._Add_Strings.md
|   |-- 43._Multiply_Strings.md
|   |-- 443._String_Compression.md
|   |-- 49._Group_Anagrams.md
|   |-- 522._Longest_Uncommon_Subsequence_II.md
|   |-- 537._Complex_Number_Multiplication.md
|   |-- 539._Minimum_Time_Difference.md
|   |-- 541._Reverse_String_II.md
|   |-- 557._Reverse_Words_in_a_String_III.md
|   |-- 57._Insert_Interval.md
|   |-- 659._Split_Array_into_Consecutive_Subsequences.md
|   |-- 67._Add_Binary.md
|   |-- 678._Valid_Parenthesis_String.md
|   |-- 680._Valid_Palindrome_II.md
|   |-- 681._Next_Closest_Time.md
|   |-- 722._Remove_Comments.md
|   |-- 767._Reorganize_String.md
|   |-- 791._Custom_Sort_String.md
|   |-- 809._Expressive_Words.md
|   |-- 824._Goat_Latin.md
|   |-- 833._Find_And_Replace_in_String.md
|   |-- 890._Find_and_Replace_Pattern.md
|   |-- 936._Stamping_The_Sequence.md
|   `-- README.md
|-- README.md
|-- Sliding-window
|   |-- Monotone_Stack.md
|   |-- Monotone_queue.md
|   |-- README.md
|   `-- easy.md
`-- stack
    |-- 1249._Minimum_Remove_to_Make_Valid_Parentheses.md
    |-- 20._Valid_Parentheses.md
    |-- 227._Basic_Calculator_II.md
    |-- 388._Longest_Absolute_File_Path.md
    |-- 844._Backspace_String_Compare.md
    |-- 856._Score_of_Parentheses.md
    |-- 946._Validate_Stack_Sequences.md
    `-- README.md

9 directories, 79 files
../README.md [error opening dir]

0 directories, 0 files
../Tree
|-- BFS
|   |-- 102._Binary_Tree_Level_Order_Traversal.md
|   |-- 126._Word_Ladder_II.md
|   |-- 1293._Shortest_Path_in_a_Grid_with_Obstacles_Elimination.md
|   |-- 1345._Jump_Game_IV.md
|   |-- 1368._Minimum_Cost_to_Make_at_Least_One_Valid_Path_in_a_Grid.md
|   |-- 1376._Time_Needed_to_Inform_All_Employees.md
|   |-- 199._Binary_Tree_Right_Side_View.md
|   |-- 279._Perfect_Squares.md
|   |-- 301._Remove_Invalid_Parentheses.md
|   |-- 752._Open_the_Lock.md
|   |-- 785._Is_Graph_Bipartite?.md
|   |-- 841._Keys_and_Rooms.md
|   |-- 854._K_Similar_Strings.md
|   `-- README.md
|-- Binary-Index-Tree
|   |-- 1505._Minimum_Possible_Integer_After_at_Most_K_Adjacent_Swaps_On_Digits.md
|   |-- 218._The_Skyline_Problem.md
|   |-- 307._Range_Sum_Query___Mutable.md
|   |-- 315._Count_of_Smaller_Numbers_After_Self.md
|   `-- README.md
|-- Binary-Lifting
|   |-- 5456._Kth_Ancestor_of_a_Tree_Node.md
|   `-- README.md
|-- DFS
|   |-- 100._Same_Tree.md
|   |-- 101._Symmetric_Tree.md
|   |-- 105._Construct_Binary_Tree_from_Preorder_and_Inorder_Traversal.md
|   |-- 108._Convert_Sorted_Array_to_Binary_Search_Tree.md
|   |-- 110._Balanced_Binary_Tree.md
|   |-- 1110._Delete_Nodes_And_Return_Forest.md
|   |-- 113._Path_Sum_II.md
|   |-- 1462._Course_Schedule_IV.md
|   |-- 173._Binary_Search_Tree_Iterator.md
|   |-- 22._Generate_Parentheses.md
|   |-- 241._Different_Ways_to_Add_Parentheses.md
|   |-- 297._Serialize_and_Deserialize_Binary_Tree.md
|   |-- 301._Remove_Invalid_Parentheses.md
|   |-- 337._House_Robber_III.md
|   |-- 426._Convert_Binary_Search_Tree_to_Sorted_Doubly_Linked_List.md
|   |-- 437._Path_Sum_III.md
|   |-- 489._Robot_Room_Cleaner.md
|   |-- 606._Construct_String_from_Binary_Tree.md
|   |-- 617._Merge_Two_Binary_Trees.md
|   |-- 996._Number_of_Squareful_Arrays.md
|   `-- README.md
|-- README.md
|-- Segment-Tree
|   |-- 307._Range_Sum_Query___Mutable.md
|   `-- README.md
`-- Trie
    |-- 1023._Camelcase_Matching.md
    |-- 1065._Index_Pairs_of_a_String.md
    |-- 1268._Search_Suggestions_System.md
    |-- 208._Implement_Trie_(Prefix_Tree).md
    |-- 425._Word_Squares.md
    |-- 648._Replace_Words.md
    |-- 745._Prefix_and_Suffix_Search.md
    `-- README.md

6 directories, 53 files
../Union-find
|-- 1168._Optimize_Water_Distribution_in_a_Village.md
|-- 128._Longest_Consecutive_Sequence.md
|-- 200._Number_of_Islands.md
|-- 261._Graph_Valid_Tree.md
|-- 323._Number_of_Connected_Components_in_an_Undirected_Graph.md
|-- 399._Evaluate_Division.md
|-- 547._Friend_Circles.md
|-- 765._Couples_Holding_Hands.md
|-- 928._Minimize_Malware_Spread_II.md
|-- 947._Most_Stones_Removed_with_Same_Row_or_Column.md
|-- 959._Regions_Cut_By_Slashes.md
`-- README.md

0 directories, 12 files

leetcode's People

Contributors

gfxcc avatar

Stargazers

 avatar

Watchers

 avatar  avatar

leetcode's Issues

found a bug in your 140 bottom up solution

path:leetcode/Dynamic-programming/One-dimension/140.-Word-Break-II.md
problem: in your leetcode solution, the bottom up is sth like this:

# Bottom up
        if set(s) > set(''.join(wordDict)):
            return []
        for x in range(len(s))[::-1]:
            dp[x] = []
            for i in range(x+1, len(s)+1):
                if s[x:i] not in wordDict: continue
                for rest in dp[i]:
                    dp[x].append(s[x:i] + (' ' + rest if rest else ''))
            if not dp[x]: return []
        return dp[0]

The last 2nd line (return will corrupt the solution). Remove that and we're good! ;)

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.