摘要:
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 阅读全文
摘要:
Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 题目含义:翻转字符串 阅读全文
摘要:
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 阅读全文
摘要:
Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 题目含义:将两个字符串进行二进制加减法。 思路:从最后一位开始依次计算,注意进位 阅读全文
摘要:
Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 给定两个字符串,判断一个字符串是不是另一个字符串 阅读全文
摘要:
给一串只包含有'(', ')', '{', '}', '[' 和']',的字符串,要求判定是否是合法的。 阅读全文
摘要:
Write a function to find the longest common prefix string amongst an array of strings. 写一个函数(或方法)来寻找一个字符串数组中的最长公共前缀。 注释 阅读全文
摘要:
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. 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 = 阅读全文
摘要:
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 阅读全文
摘要:
Design a data structure that supports all following operations in average O(1) time. 设计一个数据结构,使得插入、删除,随机获取一个元素的时间复杂度都是O(1) 阅读全文
摘要:
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. 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文