- 博客(9)
- 收藏
- 关注
原创 28. Implement strStr()
题目: Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Input: haystack = "hello", needle = "ll" Output: 2 Example...
2018-09-30 00:30:42 107
原创 查找字符串中指定字符的第一个下标_代码的优雅写法
刷 leetCode 有一个题目需要实现 String.indexOf() 的源代码,好奇之下在 Intellij IDEA 中查看了它的源代,意外地发现源码中关于在字符串中查找指定字符的下标的优雅代码(至少比我写的优雅),于是乎我打算开个贴记录一下。 String.indexOf(str) 的源代码: //解释一下:在源码中 indexOf(str) 调用了下面这个重载的方法去实现, /...
2018-09-29 21:51:08 7482
原创 27. Remove Element(运行效率打败了99.96%的人)
我的解决办法效率很高,因为采取了倒序遍历给定val的方法。 题目: Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must...
2018-09-29 14:47:50 168
原创 26. Remove Duplicates from Sorted Array
题目: Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this by mo...
2018-09-26 19:33:54 105
原创 21. Merge Two Sorted Lists
题目: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: Input: 1->2->4, 1->3->4 Output...
2018-09-26 16:34:06 112
原创 20. Valid Parentheses
题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type ...
2018-09-26 00:28:51 102
原创 14. Longest Common Prefix
题目: Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: ["flower","flow","flight"] Outp...
2018-09-24 22:25:51 104
原创 13. (LeetCode-java)Roman to Integer
题目: Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D ...
2018-09-24 19:39:37 128
原创 MySQL cmd窗口输入密码后闪退
最近重新使用回 MySQL,到官网下载客户端版(MySQL Installer)进行安装时,已经设置过 root 密码为 123456,第一次用 cmd 登录时成功。然后再安装 MySQL Workbench 进行连接,却报了错误“authentication plugin ‘caching_sha2_password’” 找到的解决办法为在 MySQL cmd 中输入: mysq...
2018-09-06 17:33:37 4042 3
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人