- 博客(25)
- 收藏
- 关注
原创 LeetCode 25. Reverse Nodes in k-Group
翻转链表 Given a linked list, reverse the nodes of a linked listkat a time and return its modified list. kis a positive integer and is less than or equal to the length of the linked list. If the numb...
2019-04-05 20:09:23 118
原创 LeetCode 61. Rotate List | 翻转k次链表
翻转链表 Given a linkedlist, rotate the list to the right bykplaces, wherekis non-negative. Example 1: Input: 1->2->3->4->5->NULL, k = 2 Output: 4->5->1->2->3->NULL ...
2019-04-05 19:38:17 149
原创 LeetCode 24. Swap Nodes in Pairs | 交换两个node(链表)
链表交换两个node Given alinked list, swap every two adjacent nodes and return its head. You maynotmodify the values in the list's nodes, only nodes itself may be changed. Example: Given 1->2-&...
2019-04-04 21:22:18 212
原创 LeetCode 15. 3Sum
给一个vector,输出加起来等于0的组合。 Given an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero. Note: The so...
2019-04-01 22:58:51 278
原创 LeetCode 22. Generate Parentheses|生成括号(递归)
生成括号(递归方法) Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, givenn= 3, a solution set is: [ "((()))", "(()())", "(())()"...
2019-04-01 20:20:38 133
原创 LeetCode 10. Regular Expression Matching
正则表达式匹配 Given an input string (s) and a pattern (p), implement regular expression matching with support for'.'and'*'. '.' Matches any single character. '*' Matches zero or more of the preceding ...
2019-03-31 21:59:07 280
原创 LeetCode 4. Median of Two Sorted Arrays
两个排好序的vector的中位数 There are two sorted arraysnums1andnums2of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). You may ...
2019-03-26 23:07:55 115
原创 LeetCode 3. Longest Substring Without Repeating Characters
最长的不重复的子串 Given a string, find the length of thelongest substringwithout repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. ...
2019-03-24 20:41:37 67
原创 LeetCode 2. Add Two Numbers
两个数字相加(我最不会的链表) You are given twonon-emptylinked lists representing two non-negative integers. The digits are stored inreverse orderand each of their nodes contain a single digit. Add the two num...
2019-03-24 19:38:42 69
原创 LeetCode 6. ZigZag Conversion
ZigZag 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 for better legibility) P A H N A P...
2019-03-23 19:51:49 69
原创 LeetCode 43. Multiply Strings
两个string相乘 Given two non-negative integersnum1andnum2represented as strings, return the product ofnum1andnum2, also represented as a string. Example 1: Input: num1 = "2", num2 = "3" Output:...
2019-03-23 18:26:02 78
原创 LeetCode 66. Plus One
加一 Given anon-emptyarray of digitsrepresenting a non-negative integer, plus one to the integer. The digits are stored such that the most significant digit is at the head of the list, and each ele...
2019-03-22 20:11:05 67
原创 LeetCode 69. Sqrt(x)
求根 Implementint sqrt(int x). Compute and return the square root ofx, wherexis guaranteed to be a non-negative integer. Since the return typeis an integer, the decimal digits are truncated and ...
2019-03-21 19:53:00 376 1
原创 LeetCode 68. Text Justification
文档适配?就类似word文档左右顶格。哇,自己做出一道hard还是有点开心的。 Given an array of words and a widthmaxWidth, format the text such that each line has exactlymaxWidthcharacters and is fully (left and right) justified. You...
2019-03-21 17:38:31 143
原创 LeetCode 65. Valid Number
Validate if a given string can be interpreted asa decimal number. Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>true" -90e3 "=>true" 1e"=>f...
2019-03-20 23:45:11 123
原创 wy笔试题(1)
n个人围成一圈,从0开始报数,报到m-1人的退出,下一个从0开始,继续报到m-1的人退出。问最后剩下的人的序号。 输入:n和m 输出:剩下的人的序号 例如: 输入:10 2 输出:5 C++版本。 最容易想到的想法。先生成一个从1到n的数组a[n],存序号。循环遍历这个数组。用q表示剩下多少个人,用p表示计数循环(0,1,2…,n,n+1,…),如果序号为k的人退出,则设a[k]=0...
2019-03-20 00:23:04 138
原创 LeetCode 53. Maximum Subarray
最大子数组的和 Given an integer arraynums, find the contiguous subarray(containing at least one number) which has the largest sum and return its sum. Example: Input: [-2,1,-3,4,-1,2,1,-5,4], Output: 6 ...
2019-03-15 10:41:12 86
原创 LeetCode 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->...
2019-03-13 11:51:07 65
原创 LeetCode 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 s...
2019-03-13 11:03:23 78
转载 C++ map和unordered_map
链接:https://blog.csdn.net/batuwuhanpei/article/details/50727227 https://www.cnblogs.com/tp-16b/p/9156810.html
2019-03-12 21:28:12 106
原创 LeetCode 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"]...
2019-03-12 21:25:33 77
原创 LeetCode 13. Roman to Integer
罗马数字转成实数。 Roman numerals are represented by seven different symbols:I,V,X,L,C,DandM。 Symbol Value I 1 V 5 X 10 L 50 C 100 ...
2019-03-12 18:08:14 67
原创 record
恢复实验Paper: How a General-Purpose Commonsense Ontology can Improve Performance of Learning-Based Image Retrieval. code: https://bitbucket.org/RToroIcarte/cn-detectors. AbstractThe knowledge representa
2017-11-11 11:14:45 254
原创 欢迎使用CSDN-markdown编辑器
第一条博客记录我的学习过程,给自己看也可分享,看我能坚持多久,就酱。大概内容数据结构 计算机网络 操作系统 计算机组成 计算机视觉内容目前写的应该都是理论内容,后面遇到有趣的再加。
2017-09-11 11:13:34 124
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人