随笔分类 - String
摘要:Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1. For
阅读全文
摘要:Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Example 1: Example 2: Note: class Soluti
阅读全文
摘要:nitially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back tothe orig
阅读全文
摘要:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. E
阅读全文
摘要:Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there ar
阅读全文
摘要:Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of
阅读全文
摘要:Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may a
阅读全文
摘要:Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the rans
阅读全文
摘要:Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Given s = "hello", return "holle". Example 2:Given s
阅读全文
摘要:Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". Write a function that takes
阅读全文
摘要:Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 和415的解法一样 class Solution { public String a
阅读全文
摘要:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan
阅读全文
摘要:The count-and-say sequence is the sequence of integers with the first five terms as following: 1 is read off as "one 1" or 11.11 is read off as "two 1
阅读全文
摘要:Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consists of lowercase English letters only and the
阅读全文
摘要:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font
阅读全文
摘要:Input: version1 = "0.1", version2 = "1.1" Output: -1 Input: version1 = "7.5.2.4", version2 = "7.5.3" Output: -1 public int compareVersion(String versi
阅读全文