- 博客(8)
- 收藏
- 关注
原创 LeetCode题解 —— 7. 整数反转
题目描述给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转。示例 1:输入: 123输出: 321示例 2:输入: -123输出: -321示例 3:输入: 120输出: 21注意:假设我们的环境只能存储得下 32 位的有符号整数,则其数值范围为 [−2^31, 2^31 − 1]。请根据这个假设,如果反转后整数溢出那么就返回 0。解题思想...
2018-11-22 22:26:09
224
原创 LeetCode题解 —— 6. Z 字形变换
题目描述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 ...
2018-05-24 10:37:20
255
转载 C++ 输入ctrl+z 不能再使用cin的问题
转载自http://www.cnblogs.com/hubavyn/p/3996413.html问题介绍: 程序步骤是开始往容器里面写数据,以Ctrl+Z来终止输入流,然后需要输入一个数据,来判断容器中是否有这个数据。源代码如下:#include<iostream>#include<map>#include<string>#include<vector>using namespace std
2018-05-23 22:05:33
941
原创 LeetCode题解 —— 5. 最长回文子串
题目描述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: &amp;quot;babad&amp;quot;Output: &amp;quot;bab&amp;quot;Note: &amp;quo
2018-05-23 21:59:02
212
原创 LeetCode题解 —— 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 time complexity should be O(log (m+n)).example1nums1 = [1, 3]nums2 =
2018-05-22 22:59:02
447
原创 LeetCode题解 —— 3. 无重复字符的最长子串
Given a string, find the length of the longest substring without repeating characters.exampleGiven “abcabcbb”, the answer is “abc”, which the length is 3.Given “bbbbb”, the answer is “b”, with the leng
2018-05-22 22:55:53
333
原创 LeetCode题解 —— 2. 两数相加
题目描述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 re...
2018-05-22 22:50:50
194
原创 LeetCode题解 —— 1. 两数之和
题目描述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 use the...
2018-05-22 22:49:55
336
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人