- 博客(10)
- 资源 (3)
- 收藏
- 关注
原创 LeetCode-38-Count and Say(计数并显示)
Q:The count-and-say sequence is the sequence of integers with the first five terms as following:1. 1 2. 11 3. 21 4. 1211 5. 1112211 is read off as “one 1” or 11. 11 is read off as
2017-07-31 18:08:41 204
原创 LeetCode-35-Search Insert Position(搜素并插入指定位置)
Q:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.Her
2017-07-28 18:04:40 234
原创 LeetCode-28-Implement strStr()(字符串匹配)
Q:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Analysis:第一反应就是用基础的KMP算法来实现,也可用其他字符串匹配算法如BM等算法。Code:public class Solution {
2017-07-27 18:46:26 317
原创 LeetCode-27-Remove Element(消除数组中给定的元素)
Q: Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.The o
2017-07-25 09:37:11 223
原创 LeetCode-26-Remove Duplicates from Sorted Array(消除已排序数组中的重复元素)
Q:Given a sorted array, 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 in place with co
2017-07-24 17:22:05 215
原创 LeetCode-21- Merge Two Sorted Lists(合并两个已排序链表)
Q: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.Analysis:题目简单,合并两个已排序的链表。需要注意的是,若有相同的元素,并没说要删除,需要“一次链接两个相同
2017-07-23 17:08:27 294
原创 LeetCode-20-Valid Parentheses(有效的括号)
Q:Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid but
2017-07-22 20:35:14 186
原创 LeetCode-14-Longest Common Prefix(最长公共前缀)
Q:Write a function to find the longest common prefix string amongst an array of strings.Analysis:先将字符串数组按每个元素的长度从小到大排序,然后用二重循环直接依次判断各个字符数组元素的字符和最短的字符串中的各个字符是否相等并返回。Code:public class Solution { publ
2017-07-21 16:42:14 239
原创 LeetCode-13-Roman to Integer(罗马数字转换为整型数字)
Q:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Analysis:可以枚举出罗马字母对应的阿拉伯数字,罗马数字来说,如果左边的字符比右边的字符小,则应该减去左边的字符,计算出整型数字;如果左边的字符大于右边的字符,则需加上右边的字符,
2017-07-20 17:04:11 370
原创 LeetCode-9-Palindrome Number(回文数)
Q: Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to string, not
2017-07-19 17:26:53 199
中文实体词典(NLP必备)
2019-02-25
《深度学习框架Pytorch快速开发与实践》数据及源代码
2019-02-24
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人