12 3x3只眼




TA的排名 4k+

【LeetCode with Python】 ZigZag Conversion

博客域名:http://www.xnerv.wang 原题页面:https://leetcode.com/problems/zigzag-conversion/ 题目类型:下标计算 难度评价:★ 本文地址:http://blog.csdn.net/nerv3x3/article/details/40660835

2015-10-05 23:15:44

【LeetCode with Python】 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 GY I RAnd then read line by line: "PAHNAPLSIIGYIR

2015-02-11 14:08:41

【LeetCode with Python】 Valid Number

Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementing

2014-11-30 21:52:37

【LeetCode with Python】 Spiral Matrix II

Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ]]

2014-11-30 21:50:32

【LeetCode with Python】 Spiral Matrix

Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]You should return [1,2,3,6,9,8,7,4,5].

2014-11-30 21:49:27



2014-11-30 21:48:12

【LeetCode with Python】 Single Number II

Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?

2014-09-21 17:52:05

【LeetCode with Python】 Sort Colors

Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue re

2014-09-21 17:51:15

【LeetCode with Python】 Search Insert Position

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.Here are few examples.[1,3,5,6], 5 → 2[1,3,5,6], 2 → 1

2014-09-21 17:50:11

【LeetCode with Python】 Simplify Path

Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"click to show corner cases.Corner Cases: Did you consider the case where path = "/../"? In this case, you sh

2014-09-21 17:49:20


Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is now [1,1,2,2,3].

2014-09-21 17:47:40

【LeetCode with Python】 Search in Rotated Sorted Array

Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array return its index, otherwise return -1.You may assume no duplicate

2014-09-21 17:47:15

【LeetCode with Python】 Partition List

Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of the two partitions.For example,Given 1->4->3->2->5->2

2014-09-21 17:46:32

【LeetCode with Python】 N-Queens II

Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.

2014-09-21 17:45:37

【LeetCode with Python】 N-Queens

The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle.Each solution contains a distinct board configuration of the

2014-09-21 17:44:49

【LeetCode with Python】 Insert Interval

Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example 1:Given intervals [1,3],[6,9], insert and merge [2,5

2014-09-21 17:41:53

【LeetCode with Python】 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.

2014-09-21 17:41:21

【LeetCode with Python】 Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like: 1 \ 2 \ 3 \ 4 \

2014-09-21 17:38:47

【LeetCode with Python】 Count and Say

The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as "one 2, then one 1" or 1211.Given an integer n, generate the nt

2014-09-21 17:38:23

【LeetCode with Python】 Divide Two Integers

Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.

2014-09-21 17:37:42


勋章 我的勋章
  • 专栏达人