
LeetCode刷题
sf_jiang
JSF
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Contiguous Array
题目描述:Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.Note: The length of the given binary array will not exceed 50,000.思路,参考官网,将数组中的 0 全都转化为 -1,...原创 2018-10-13 12:13:54 · 245 阅读 · 0 评论 -
two sum / three sum
一:TWO SUM,Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not u...原创 2018-10-14 23:25:10 · 225 阅读 · 0 评论 -
Frog Jump
A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.Given a list of s...原创 2018-10-17 01:04:50 · 392 阅读 · 0 评论 -
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 element....原创 2018-10-30 11:32:52 · 402 阅读 · 0 评论 -
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 two numbers and return i...原创 2018-10-30 17:55:14 · 156 阅读 · 0 评论 -
Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2:...原创 2018-10-30 23:54:49 · 174 阅读 · 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.Example 1:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.Exa...原创 2018-11-29 01:12:12 · 175 阅读 · 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 pattern in a fixed font for better legibility)P A H NA P L S I I...原创 2018-12-14 16:59:48 · 155 阅读 · 0 评论 -
写好一个函数的基本“规矩”
函数是软件产品的细胞。如何写好一个命名规范,功能清晰,鲁棒性强的函数,是一个合格程序员的基本素养。条例1: 一定要对非法输入做错误处理。 写函数最忌讳的就是不对非法输入做错误处理。调用malloc等可能出错的函数不判断返回值。这样的函数放到一个庞大复杂的系统中将是灾难。不是宕机就是出core或者各种错误的结果。曾经看过一篇文章,说是cpu感触的1纳秒,就相当于人...原创 2019-08-06 11:49:28 · 202 阅读 · 0 评论