关闭

Expression Expand

java 思路不复杂,只是代码的量有点大,而且涉及到了一些类型转换。 public class Solution { /* * @param s: an expression includes numbers, letters and brackets * @return: a string */ public String expressionE...
阅读(2) 评论(0)

412. Fizz Buzz

Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. ...
阅读(38) 评论(0)

Two Sum - Difference equals to target

Given an array of integers, find two numbers that their difference equals to a target value. where index1 must be less than index2. Please note that your returned answers (both index1 and index2)...
阅读(74) 评论(0)

18. 4Sum

Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: The solution s...
阅读(25) 评论(0)

16. 3Sum Closest

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. You may assume that each input would have exact...
阅读(65) 评论(0)

Two Sum - Closest to target

Given an array nums of n integers, find two integers in nums such that the sum is closest to a given number, target. Return the difference between the sum of the two integers and the target. H...
阅读(40) 评论(0)

Two Sum - Greater than target

Given an array of integers, find how many pairs in the array such that their sum is bigger than a specific target number. Please return the number of pairs. 这种题目,相当于是固定一个然后变化另外一个,然后统计总数 java publ...
阅读(14) 评论(0)

Two Sum - Less than or equal to target

Given an array of integers, find how many pairs in the array such that their sum is less than or equal to a specific target number. Please return the number of pairs. java public class Solution { ...
阅读(11) 评论(0)

167. Two Sum II - Input array is sorted

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers ...
阅读(15) 评论(0)

15. 3Sum

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 zero. Note: The solution set must not contain d...
阅读(35) 评论(0)

Two Sum - Unique pairs

Given an array of integers, find how many unique pairsin the array such that their sum is equal to a specific target number. Please return the number of pairs. Have you met this question in a r...
阅读(38) 评论(0)

Two Sum - Input array is sorted

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two number...
阅读(12) 评论(0)

Two Sum - Data structure design

Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure. find - Find if there exists any pair of numbers w...
阅读(20) 评论(0)

75. leetcode 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 ...
阅读(43) 评论(0)

Sort Letters by Case

Given a string which contains only letters. Sort it by lower case first and upper case second. java public class Solution { /* * @param chars: The letter array you should sort by Case ...
阅读(59) 评论(0)
421条 共29页1 2 3 4 5 ... 下一页 尾页
    个人资料
    • 访问:90483次
    • 积分:4712
    • 等级:
    • 排名:第6582名
    • 原创:383篇
    • 转载:33篇
    • 译文:5篇
    • 评论:43条
    文章分类