摘要:
Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Given s = "hello", return "holle". Example 2:Given s 阅读全文
posted @ 2017-10-16 21:58
daniel456
阅读(86)
评论(0)
推荐(0)
摘要:
Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 题目含义:翻转字符串 阅读全文
posted @ 2017-10-16 21:56
daniel456
阅读(123)
评论(0)
推荐(0)
摘要:
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan 阅读全文
posted @ 2017-10-16 21:55
daniel456
阅读(100)
评论(0)
推荐(0)
摘要:
Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 题目含义:将两个字符串进行二进制加减法。 思路:从最后一位开始依次计算,注意进位 阅读全文
posted @ 2017-10-16 21:46
daniel456
阅读(119)
评论(0)
推荐(0)
摘要:
Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 给定两个字符串,判断一个字符串是不是另一个字符串 阅读全文
posted @ 2017-10-16 21:42
daniel456
阅读(110)
评论(0)
推荐(0)
摘要:
给一串只包含有'(', ')', '{', '}', '[' 和']',的字符串,要求判定是否是合法的。 阅读全文
posted @ 2017-10-16 21:34
daniel456
阅读(94)
评论(0)
推荐(0)
摘要:
Write a function to find the longest common prefix string amongst an array of strings. 写一个函数(或方法)来寻找一个字符串数组中的最长公共前缀。 注释 阅读全文
posted @ 2017-10-16 21:32
daniel456
阅读(90)
评论(0)
推荐(0)
摘要:
Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get. 阅读全文
posted @ 2017-10-16 20:52
daniel456
阅读(167)
评论(0)
推荐(0)
摘要:
Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requ 阅读全文
posted @ 2017-10-16 20:49
daniel456
阅读(295)
评论(0)
推荐(0)
摘要:
Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could 阅读全文
posted @ 2017-10-16 20:02
daniel456
阅读(640)
评论(0)
推荐(0)
摘要:
Given an array consists of non-negative integers, your task is to count the number of triplets chosen from the array that can make triangles if we tak 阅读全文
posted @ 2017-10-16 19:40
daniel456
阅读(123)
评论(0)
推荐(0)
摘要:
Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Input:nums = 阅读全文
posted @ 2017-10-16 19:26
daniel456
阅读(162)
评论(0)
推荐(0)
摘要:
Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twi 阅读全文
posted @ 2017-10-16 19:21
daniel456
阅读(121)
评论(0)
推荐(0)
摘要:
Design a data structure that supports all following operations in average O(1) time. 设计一个数据结构,使得插入、删除,随机获取一个元素的时间复杂度都是O(1) 阅读全文
posted @ 2017-10-16 17:41
daniel456
阅读(148)
评论(0)
推荐(0)
摘要:
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. 阅读全文
posted @ 2017-10-16 16:55
daniel456
阅读(167)
评论(0)
推荐(0)
摘要:
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except 阅读全文
posted @ 2017-10-16 16:41
daniel456
阅读(124)
评论(0)
推荐(0)
摘要:
Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't 阅读全文
posted @ 2017-10-16 16:26
daniel456
阅读(107)
评论(0)
推荐(0)
摘要:
A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its inde 阅读全文
posted @ 2017-10-16 16:13
daniel456
阅读(89)
评论(0)
推荐(0)
摘要:
Suppose an array sorted in ascending order 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). Find 阅读全文
posted @ 2017-10-16 16:10
daniel456
阅读(112)
评论(0)
推荐(0)
摘要:
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo 阅读全文
posted @ 2017-10-16 16:00
daniel456
阅读(128)
评论(0)
推荐(0)
摘要:
Given inorder and postorder traversal of a tree, construct the binary tree. 题目:给定一个树的中序排列和后续排列数组,重新绘制出该树 思路:由于后序的顺序的最后一个肯定是根,所以原二叉树的根节点可以知道,题目中给了一个很关键 阅读全文
posted @ 2017-10-16 15:44
daniel456
阅读(183)
评论(0)
推荐(0)
摘要:
Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 给定一个二叉树的先序遍历和 阅读全文
posted @ 2017-10-16 15:20
daniel456
阅读(165)
评论(0)
推荐(0)
摘要:
Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac 阅读全文
posted @ 2017-10-16 11:19
daniel456
阅读(159)
评论(0)
推荐(0)
摘要:
Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example,If nums = 阅读全文
posted @ 2017-10-16 11:16
daniel456
阅读(156)
评论(0)
推荐(0)
摘要:
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, 阅读全文
posted @ 2017-10-16 11:03
daniel456
阅读(125)
评论(0)
推荐(0)
摘要:
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted f 阅读全文
posted @ 2017-10-16 10:59
daniel456
阅读(130)
评论(0)
推荐(0)
摘要:
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文
posted @ 2017-10-16 10:52
daniel456
阅读(129)
评论(0)
推荐(0)
摘要:
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p 阅读全文
posted @ 2017-10-16 10:45
daniel456
阅读(119)
评论(0)
推荐(0)
摘要:
Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. 题目:合并线段 阅读全文
posted @ 2017-10-16 10:39
daniel456
阅读(133)
评论(0)
推荐(0)
摘要:
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文
posted @ 2017-10-16 10:35
daniel456
阅读(135)
评论(0)
推荐(0)
摘要:
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note:You have to rotate the image in-place, which 阅读全文
posted @ 2017-10-16 08:29
daniel456
阅读(192)
评论(0)
推荐(0)
摘要:
Given an array of integers sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime complexi 阅读全文
posted @ 2017-10-16 08:24
daniel456
阅读(144)
评论(0)
推荐(0)
摘要:
Suppose an array sorted in ascending order 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 a 阅读全文
posted @ 2017-10-16 07:58
daniel456
阅读(137)
评论(0)
推荐(0)
摘要:
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 integers. 阅读全文
posted @ 2017-10-16 07:56
daniel456
阅读(100)
评论(0)
推荐(0)
摘要:
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 sum of 阅读全文
posted @ 2017-10-16 07:54
daniel456
阅读(124)
评论(0)
推荐(0)
摘要:
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 endpo 阅读全文
posted @ 2017-10-16 07:53
daniel456
阅读(132)
评论(0)
推荐(0)

浙公网安备 33010602011771号