John Will的博客

一个人的独白。

4Sum

题目描述Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the ...

2018-04-23 22:31:27

阅读数:14

评论数:0

3Sum Closest 最接近目标数的三个数和

题目描述Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three in...

2018-04-23 21:35:43

阅读数:14

评论数:0

3Sum 三数之和

题目描述Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the...

2018-04-23 20:49:23

阅读数:24

评论数:0

Longest Common Prefix 最长公共前缀

题目描述Write a function to find the longest common prefix string amongst an array of strings. 题意:求多个字符串的最长公共前缀.分析:一位一位判断即可.实现代码:             class Solu...

2018-04-23 19:58:04

阅读数:10

评论数:0

Roman to Integer

题目描述Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 实现代码:             class Solution {p...

2018-04-23 15:45:02

阅读数:12

评论数:0

Integer to Roman (罗马数字转换)

题目描述Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 科普了一下表达方式,理解了就不复杂了。I = 1;V = 5;X = ...

2018-04-23 15:21:57

阅读数:16

评论数:0

container-with-most-water

题目描述Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two ...

2018-04-23 14:28:55

阅读数:14

评论数:0

Regular Expression Matching 正则表达式匹配和递归

题目描述Implement regular expression matching with support for'.'and'*'.'.' Matches any single character. '*' Matches zero or more of the preceding eleme...

2018-04-21 21:12:20

阅读数:13

评论数:0

Palindrome Number回文串数字

题目描述Determine whether an integer is a palindrome. Do this without extra space. 判断一个数字是不是回文串,来回读都是一样的!!!实现代码:             class Solution {public:    ...

2018-04-21 17:15:01

阅读数:24

评论数:0

String to Integer (atoi)

题目描述Implement atoi to convert a string to an integer. 实现代码:             class Solution {public:    int atoi(const char *str) {        string s(str);...

2018-04-21 16:16:21

阅读数:16

评论数:0

Reverse Integer(翻转整数)

题目描述Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 click to show spoilers.Have you thought about this? ...

2018-04-21 15:15:40

阅读数:11

评论数:0

ZigZag Conversion 之字形转换

题目描述The string"PAYPALISHIRING"is written in a zigzag pattern on a given number of rows like this: (you may want to display this p...

2018-04-20 21:12:14

阅读数:11

评论数:0

Longest Palindromic Substring

题目描述Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one uniqu...

2018-04-20 14:06:36

阅读数:9

评论数:0

Add Two Numbers

题目描述You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a ...

2018-04-20 08:53:12

阅读数:10

评论数:0

Longest Substring Without Repeating Characters

题目描述Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating let...

2018-04-19 21:26:20

阅读数:6

评论数:0

Median of Two Sorted Arrays求中位数

题目描述There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sho...

2018-04-19 20:01:19

阅读数:8

评论数:0

two-sum

题目描述Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of t...

2018-04-19 16:12:38

阅读数:9

评论数:0

Letter Combinations of a Phone Number (电话号码字母组合)

题目描述Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the...

2018-04-19 14:28:27

阅读数:8

评论数:0

Remove Nth Node From End of List

题目描述Given a linked list, remove the n th node from the end of list and return its head. For example, Given linked list: 1->2-&a...

2018-04-19 09:43:46

阅读数:8

评论数:0

Valid Parentheses

题目描述Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid. The brackets must close in th...

2018-04-18 22:54:41

阅读数:12

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭