This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.string; | |
import static com.hrishikesh.practices.string.VersionNumberComparer.compare; | |
/** | |
* Problem | |
* Compare Version Numbers | |
* Compare two version numbers version1 and version2. | |
* If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.string; | |
import static com.hrishikesh.practices.string.ValidPalindrome.isPalindrome; | |
/** | |
* Problem: | |
* Valid Palindrome | |
* Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases | |
* | |
* @author hrishikesh.mishra |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.string; | |
import java.util.Stack; | |
/** | |
* Problem: | |
* Simplify Unix Path | |
* | |
* @author hrishikesh.mishra | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.string; | |
import static com.hrishikesh.practices.string.ShortestPalindrome.findByKMP; | |
/** | |
* Problem | |
* Shortest Palindrome | |
* Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. | |
* Find and return the shortest palindrome you can find by performing this transformation. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.string; | |
/** | |
* Problem | |
* Repeated SubString | |
* | |
* @author hrishikesh.mishra | |
*/ | |
public class RepeatedSubstringPattern { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.string; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import static com.hrishikesh.practices.string.PalindromePairsFinder.find; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.string; | |
/** | |
* Problem: | |
* Number of Segments in a String | |
* Count the number of segments in a string, where a segment | |
* is defined to be a contiguous sequence of non-space characters | |
* | |
* @author hrishikesh.mishra | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.string; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Objects; | |
import java.util.Stack; | |
/** | |
* Problem | |
* Mini Parser |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.string; | |
import java.util.HashMap; | |
import java.util.Map; | |
/** | |
* Problem: | |
* Minimum Window Substring In O(n) | |
* Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.string; | |
/** | |
* Problem | |
* IP Validator | |
* | |
* @author hrishikesh.mishra | |
*/ | |
public class IPValidator { |
OlderNewer