上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 21 下一页
摘要: 描述 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 fo 阅读全文
posted @ 2018-09-11 10:26 banshaohuan 阅读(145) 评论(0) 推荐(0)
摘要: 9. 回文数 描述 判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。 示例 示例 1: 输入: 121 输出: true 示例 2: 输入: 121 输出: false 解释: 从左向右读, 为 121 。 从右向左读, 为 121 。因此它不是一个回文数。 阅读全文
posted @ 2018-09-11 10:25 banshaohuan 阅读(124) 评论(0) 推荐(0)
摘要: 8. 字符串转整数 (atoi) 描述 实现 atoi,将字符串转为整数。 在找到第一个非空字符之前,需要移除掉字符串中的空格字符。如果第一个非空字符是正号或负号,选取该符号,并将其与后面尽可能多的连续的数字组合起来,这部分字符即为整数的值。如果第一个非空字符是数字,则直接将其与之后连续的数字字符组 阅读全文
posted @ 2018-09-10 16:38 banshaohuan 阅读(120) 评论(0) 推荐(0)
摘要: 描述 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" Outpu 阅读全文
posted @ 2018-09-10 16:37 banshaohuan 阅读(101) 评论(0) 推荐(0)
摘要: 4. 两个排序数组的中位数 问题描述 There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run 阅读全文
posted @ 2018-09-07 10:53 banshaohuan 阅读(129) 评论(0) 推荐(0)
摘要: 7. 反转整数 描述 给定一个 32 位有符号整数,将整数中的数字进行反转。 示例 示例 1: 输入: 123 输出: 321 示例 2: 输入: 123 输出: 321 示例 3: 输入: 120 输出: 21 注意: 假设我们的环境只能存储 32 位有符号整数,其数值范围是 [−2^31, 2^ 阅读全文
posted @ 2018-09-07 10:29 banshaohuan 阅读(183) 评论(0) 推荐(0)
摘要: 3. 无重复字符的最长子串 问题描述 Given a string, find the length of the longest substring without repeating characters. Example Given "abcabcbb", the answer is "abc 阅读全文
posted @ 2018-09-06 12:08 banshaohuan 阅读(150) 评论(0) 推荐(0)
摘要: 24. 两两交换链表中的节点 描述 给定一个链表,两两交换其中相邻的节点,并返回交换后的链表。 示例 给定 1 2 3 4, 你应该返回 2 1 4 3. 说明: 你的算法只能使用常数的额外空间。 你不能只是单纯的改变节点内部的值 ,而是需要实际的进行节点交换。 思路 链表的交换其实就是指针的交换, 阅读全文
posted @ 2018-09-06 12:04 banshaohuan 阅读(114) 评论(0) 推荐(0)
摘要: 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 ea 阅读全文
posted @ 2018-09-05 13:23 banshaohuan 阅读(114) 评论(0) 推荐(0)
摘要: 23. 合并K个排序链表 描述 合并 k 个排序链表,返回合并后的排序链表。请分析和描述算法的复杂度。 示例 输入: [ 1 4 5, 1 3 4, 2 6 ] 输出: 1 1 2 3 4 4 5 6 思路 思路一 这道题是第 21 道题的升级版,所以可以借助第 21 题的算法。 方法是重复将列表中 阅读全文
posted @ 2018-09-05 13:20 banshaohuan 阅读(178) 评论(0) 推荐(0)
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 21 下一页