随笔分类 -  String

摘要:Given a string S of lowercase letters, a duplicate removal consists of choosing two adjacent and equal letters, and removing them. We repeatedly make 阅读全文
posted @ 2020-02-07 08:18 北叶青藤 阅读(147) 评论(0) 推荐(0)
摘要:Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: The length of both num1 and num2 is < 5100 阅读全文
posted @ 2020-02-07 06:38 北叶青藤 阅读(172) 评论(0) 推荐(0)
摘要:Given a string s of '(' , ')' and lowercase English characters. Your task is to remove the minimum number of parentheses ( '(' or ')', in any position 阅读全文
posted @ 2020-02-06 13:46 北叶青藤 阅读(170) 评论(0) 推荐(0)
摘要:Given two sentences words1, words2 (each represented as an array of strings), and a list of similar word pairs pairs, determine if two sentences are s 阅读全文
posted @ 2020-02-06 12:22 北叶青藤 阅读(192) 评论(0) 推荐(0)
摘要:Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Example 1: Input: "aba" Output: True Exa 阅读全文
posted @ 2020-02-04 01:16 北叶青藤 阅读(123) 评论(0) 推荐(0)
摘要:In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permu 阅读全文
posted @ 2020-01-30 14:39 北叶青藤 阅读(286) 评论(0) 推荐(0)
摘要:问题一: pi表示取第i个单,di表示送第i个单。di不能在pi的前面。给一个取单送单的顺序,问是否是valid顺序。 1 public boolean isValidOrderList(List<String> list) { 2 Set<String> set = new HashSet<>() 阅读全文
posted @ 2019-11-18 01:56 北叶青藤 阅读(461) 评论(0) 推荐(0)
摘要:Infix : An expression is called the Infix expression if the operator appears in between the operands in the expression. Simply of the form (operand1 o 阅读全文
posted @ 2019-08-08 00:35 北叶青藤 阅读(457) 评论(0) 推荐(0)
摘要:Infix expression: The expression of the form a op b. When an operator is in-between every pair of operands.Postfix expression: The expression of the f 阅读全文
posted @ 2019-08-08 00:24 北叶青藤 阅读(288) 评论(0) 推荐(0)
摘要:Infix : An expression is called the Infix expression if the operator appears in between the operands in the expression. Simply of the form (operand1 o 阅读全文
posted @ 2019-08-08 00:14 北叶青藤 阅读(384) 评论(0) 推荐(0)
摘要:Postfix to Prefix Conversion Postfix: An expression is called the postfix expression if the operator appears in the expression after the operands. Sim 阅读全文
posted @ 2019-08-08 00:07 北叶青藤 阅读(466) 评论(0) 推荐(0)
摘要:You are given a string with lower case letters only. Compress it by putting the count of the letter after it. If the letter appears once, Example: com 阅读全文
posted @ 2019-08-05 04:52 北叶青藤 阅读(279) 评论(0) 推荐(0)
摘要:Given a list of directory info including directory path, and all the files with contents in this directory, you need to find out all the groups of dup 阅读全文
posted @ 2019-07-28 03:22 北叶青藤 阅读(631) 评论(0) 推荐(0)
摘要:Two strings X and Y are similar if we can swap two letters (in different positions) of X, so that it equals Y. For example, "tars" and "rats" are simi 阅读全文
posted @ 2019-07-28 01:36 北叶青藤 阅读(249) 评论(0) 推荐(0)
摘要:Given many words, words[i] has weight i. Design a class WordFilter that supports one function, WordFilter.f(String prefix, String suffix). It will ret 阅读全文
posted @ 2019-07-27 14:18 北叶青藤 阅读(282) 评论(0) 推荐(0)
摘要:You are given several logs that each log contains a unique id and timestamp. Timestamp is a string that has the following format: Year:Month:Day:Hour: 阅读全文
posted @ 2019-07-25 14:42 北叶青藤 阅读(327) 评论(0) 推荐(0)
摘要:Example : Infix : (A+B) * (C-D) ) Postfix: AB+CD-* 算法: 1. Scan the infix expression from left to right. 2. If the scanned character is an operand, app 阅读全文
posted @ 2019-07-22 13:40 北叶青藤 阅读(356) 评论(0) 推荐(0)
摘要:Given a list of strings, output the most frequent characters that are in the same group as the letter. For example, for string "abc", a, b,c are in th 阅读全文
posted @ 2019-07-22 13:02 北叶青藤 阅读(356) 评论(0) 推荐(0)
摘要:Given a rows x cols screen and a sentence represented by a list of words, find how many times the given sentence can be fitted on the screen. Note: A 阅读全文
posted @ 2019-07-18 12:58 北叶青藤 阅读(220) 评论(0) 推荐(0)
摘要:Given a string S, find the number of different non-empty palindromic subsequences in S, and return that number modulo 10^9 + 7. A subsequence of a str 阅读全文
posted @ 2019-07-18 12:01 北叶青藤 阅读(284) 评论(0) 推荐(0)