You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2
Original file line number
Diff line number
Diff line change
@@ -135,6 +135,7 @@ A collection of solution to the data structure and algorithm problems
135
135
|[SingleNumberII](src/questions/SingleNumberII.kt) <br><sub>Kotlin • questions</sub> | <sup>Given an integer array nums where every element appears three times except for one, which appears exactly once. Find the single element and return it. <br> [Source](https://leetcode.com/problems/single-number-ii/)</sup> |
136
136
|[NextGreaterElementII](src/questions/NextGreaterElementII.kt) <br><sub>Kotlin • questions</sub> | <sup>Given a circular integer array nums (i.e., the next element of nums[nums.length - 1] is nums[0]), return the next greater number for every element in nums. The next greater number of a number x is the first greater number to its traversing-order next in the array, which means you could search circularly to find its next greater number. If it doesn't exist, return -1 for this number. <br> [Source](https://leetcode.com/problems/next-greater-element-ii/)</sup> |
137
137
|[ArrayPartitionI](src/questions/ArrayPartitionI.kt) <br><sub>Kotlin • questions</sub> | <sup>Given an integer array nums of 2n integers, group these integers into n pairs (a1, b1), (a2, b2), ..., (an, bn) such that the sum of min(ai, bi) for all i is maximized. Return the maximized sum. [Source](https://leetcode.com/problems/array-partition-i/)</sup> |
138
+
|[WildcardSearchDS](src/questions/WildcardSearchDS.kt) <br><sub>Kotlin • questions</sub> | <sup>Design a data structure that supports adding new words and finding if a string matches any previously added string. Your data structure should implement two methods <br>*`addWord(word)`- Adds word to the data structure <br>*`searchWorld(word)`- Returns true if there is any string in the data structure that matches word. Word may contain dots where a dot can be matched with any letter (a dot represents a wildcard).</sup> |
138
139
|[MaxAreaOfIsland](src/questions/MaxAreaOfIsland.kt) <br><sub>Kotlin • questions</sub> | <sup>You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water. Return the maximum area of an island in grid. If there is no island, return 0. <imgsrc="https://assets.leetcode.com/uploads/2021/05/01/maxarea1-grid.jpg"height="150"width="150"/> [Source](https://leetcode.com/problems/max-area-of-island)</sup> |
139
140
|[LengthOfLastWord](src/questions/LengthOfLastWord.kt) <br><sub>Kotlin • questions</sub> | <sup>Given a string s consisting of some words separated by some number of spaces, return the length of the last word in the string. A word is a maximal substring consisting of non-space characters only. <br> [Source](https://leetcode.com/problems/length-of-last-word)</sup> |
140
141
|[HammingDistance](src/questions/HammingDistance.kt) <br><sub>Kotlin • questions</sub> | <sup>The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, return the Hamming distance between them. [Source](https://leetcode.com/problems/hamming-distance/)</sup> |
@@ -148,6 +149,7 @@ A collection of solution to the data structure and algorithm problems
148
149
|[RangeSumQueryMutable](src/questions/RangeSumQueryMutable.kt) <br><sub>Kotlin • questions</sub> | <sup>Given an integer array nums, handle multiple queries of the following types: <br>* Update the value of an element in nums. <br>* Calculate the sum of the elements of nums between indices left and right inclusive where left <= right. <br> [Source](https://leetcode.com/problems/range-sum-query-mutable/)</sup> |
149
150
|[PascalTriangle](src/questions/PascalTriangle.kt) <br><sub>Kotlin • questions</sub> | <sup>Given an integer numRows, return the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it as shown: <br> <imgsrc="https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif"height="150"width="150"/> [Source](https://leetcode.com/problems/pascals-triangle/)</sup> |
150
151
|[ExcelSheetColumnTitle](src/questions/ExcelSheetColumnTitle.kt) <br><sub>Kotlin • questions</sub> | <sup>Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet. `A -> 1, B -> 2, C -> 3, Z -> 26, AA -> 27, AB -> 28` <br> [Source](https://leetcode.com/problems/excel-sheet-column-title/)</sup> |
152
+
|[NimGame](src/questions/NimGame.kt) <br><sub>Kotlin • questions</sub> | <sup>You are playing the following Nim Game with your friend: <br> <br>* Initially, there is a heap of stones on the table. <br>* You and your friend will alternate taking turns, and you go first. <br>* On each turn, the person whose turn it is will remove 1 to 3 stones from the heap. <br>* The one who removes the last stone is the winner. <br> Given n, the number of stones in the heap, return true if you can win the game assuming both you and your friend play optimally, otherwise return false. <br> [Source](https://leetcode.com/problems/nim-game/) – [Solution](https://leetcode.com/problems/nim-game/discuss/73749/Theorem:-all-4s-shall-be-false)</sup> |
151
153
|[ValidPalindrome](src/questions/ValidPalindrome.kt) <br><sub>Kotlin • questions</sub> | <sup>Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.</sup> |
152
154
|[LongestPalindrome](src/questions/LongestPalindrome.kt) <br><sub>Kotlin • questions</sub> | <sup>Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters. <br> Letters are case sensitive, for example, "Aa" is not considered a palindrome here. <br> [Source](https://leetcode.com/problems/longest-palindrome/)</sup> |
153
155
|[PlusOne](src/questions/PlusOne.kt) <br><sub>Kotlin • questions</sub> | <sup>You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading 0's. Increment the large integer by one and return the resulting array of digits. <br> [Source](https://leetcode.com/problems/plus-one/)</sup> |
* Design a data structure that supports adding new words and finding if a string matches any previously added string.
7
+
* Your data structure should implement two methods
8
+
* * `addWord(word)`- Adds word to the data structure
9
+
* * `searchWorld(word)`- Returns true if there is any string in the data structure that matches word. Word may contain dots where a dot can be matched with any letter (a dot represents a wildcard).
0 commit comments