关闭

[问题解决] multiple definition of `***'

make发现问题如下: 我是把  pthread_mutex_t VT_Mutex;   这一句写在 init.h 里面。 解决办法: 把 pthread_mutex_t VT_Mutex;  写在init.c 里面,init.c include init.h 在init.h 里面写 extern pthread_mutex_t VT_Mutex;...
阅读(27) 评论(0)

leetcode 149. Max Points on a Line

149. Max Points on a Line Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.   1、遍历每一个点,作为基准点   2、其他点与之比较,用map来存斜率,特殊考虑 垂直和复制的情况。  现在有一个数...
阅读(9) 评论(0)

leetcode 69. Sqrt(x)

69. Sqrt(x) Implement int sqrt(int x). Compute and return the square root of x. x is guaranteed to be a non-negative integer. Example 1: Input: 4 Output: 2 Example 2: Input: 8 Output...
阅读(7) 评论(0)

leetcode 66. Plus One

66. Plus One Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leading zero, except the number 0 i...
阅读(9) 评论(0)

leetcode 60. Permutation Sequence

60. Permutation Sequence The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the following sequence (ie, for n =...
阅读(7) 评论(0)

leetcode 50. Pow(x, n)

50. Pow(x, n) Implement pow(x, n). Example 1: Input: 2.00000, 10 Output: 1024.00000 Example 2: Input: 2.10000, 3 Output: 9.26100 class Solution { public: double m...
阅读(9) 评论(0)

leetcode 29. Divide Two Integers

29. Divide Two Integers Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 题目的意思是两数除法,但不使用乘法,除法,取模等运算符来做。 回想除法的最朴素思想: 即,当   被除数>除数...
阅读(8) 评论(0)

leetcode 9. Palindrome Number

9. Palindrome Number Determine whether an integer is a palindrome. Do this without extra space. way-1: force, 强行每次把首位两个数字提出来比较。 way-2:int to string class Solution { public: str...
阅读(10) 评论(0)

leetcode 7. Reverse Integer

7. Reverse Integer Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 ...
阅读(27) 评论(0)

leetcode 2. Add Two Numbers

2. Add Two Numbers You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the ...
阅读(62) 评论(0)

KMP算法(代码)

KMP是字符串模式匹配算法,主要的核心: 对于目标字符串ptr,ababaca,长度是7,所以next[0],next[1],next[2],next[3],next[4],next[5],next[6]分别计算的是  a,ab,aba,abab,ababa,ababac,ababaca的相同的最长前缀和最长后缀的长度。由于a,ab,aba,abab,ababa,ababac,ab...
阅读(78) 评论(0)

leetcode 214. Shortest Palindrome

214. Shortest Palindrome Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can find by performing th...
阅读(30) 评论(0)

leetcode 165. Compare Version Numbers

165. Compare Version Numbers Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0. You may assume that the ve...
阅读(13) 评论(0)

leetcode 151. Reverse Words in a String

151. Reverse Words in a String Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". 如果要求O(1)空间,那就只能是前后找第一个单词然后换位置。那就比较...
阅读(11) 评论(0)

leetcode 125. Valid Palindrome

125. Valid Palindrome Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A man, a plan, a canal: Panama" is a palindro...
阅读(18) 评论(0)

leetcode 93. Restore IP Addresses

93. Restore IP Addresses Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example: Given "25525511135", return ["255.255.11.13...
阅读(11) 评论(0)

leetcode 76. Minimum Window Substring

76. Minimum Window Substring Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example, S = "ADOBECODEBANC" T =...
阅读(16) 评论(0)

leetcode 71. Simplify Path

71. Simplify Path Given an absolute path for a file (Unix-style), simplify it. For example, path = "/home/", => "/home" path = "/a/./b/../../c/", => "/c" class Solution { public: stri...
阅读(12) 评论(0)

leetcode 68. Text Justification

68. Text Justification Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You should pack your words ...
阅读(16) 评论(0)

leetcode 67. Add Binary

67. Add Binary Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". class Solution { public: string addBinary(st...
阅读(14) 评论(0)
136条 共7页1 2 3 4 5 ... 下一页 尾页
    个人资料
    • 访问:4251次
    • 积分:1367
    • 等级:
    • 排名:千里之外
    • 原创:136篇
    • 转载:0篇
    • 译文:0篇
    • 评论:0条
    文章分类