-
最大匹配字符串:https://leetcode.cn/problems/find-maximum-number-of-string-pairs/description/
判斷字符串?dāng)?shù)組中 字符串與某個(gè)字符串反轉(zhuǎn)后是否一致;
StringBuffer 或者 StringBuidler的 reverse方法 -
回文數(shù): https://leetcode.cn/problems/palindrome-number/
StringBuffer 或者 StringBuidler的 reverse方法
-
羅馬數(shù)字轉(zhuǎn)整數(shù):https://leetcode.cn/problems/roman-to-integer/
字符串截取substring(0,2) 前閉后開(kāi)
-
最長(zhǎng)公共前綴: https://leetcode.cn/problems/longest-common-prefix/
startsWith substring(0,str.length()) 保證截取到完整的子串
-
移除元素 https://leetcode.cn/problems/remove-element/
要求空間為O(N),則先計(jì)算移除后剩下的元素個(gè)數(shù)M,然后把M個(gè)元素前面要移除的元素替換為M之后的不需要被移除的元素;
t =a;
a=b;
b=t; 倆元素交換值 -
找出字符串中第一個(gè)匹配的下標(biāo),不存在返回-1: https://leetcode.cn/problems/find-the-index-of-the-first-occurrence-in-a-string/文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-801255.html
stringA.indexOf(subStr)文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-801255.html
到了這里,關(guān)于Java leetcode簡(jiǎn)單刷題記錄1的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!