- 博客(19)
- 资源 (1)
- 收藏
- 关注
原创 Multiply Strings
Multiply Strings Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Example Input: num1 = “2”, num2 = “3” Outpu...
2018-12-30 14:33:36 93
原创 Add Binary
Add Binary Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1 or 0. Example Input: a = “11”, b = “1” Output: “100...
2018-12-30 12:13:54 79
原创 Non-negative Integers without Consecutive Ones
Non-negative Integers without Consecutive Ones Given a positive integer n, find the number of non-negative integers less than or equal to n, whose binary representations do NOT contain consecutive on...
2018-12-30 01:48:27 228
原创 Delete and Earn
Delete and Earn Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must delete every el...
2018-12-25 15:12:40 86
原创 Find Pivot Index
Find Pivot Index Given an array of integers nums, write a method that returns the “pivot” index of this array. We define the pivot index as the index where the sum of the numbers to the left of the i...
2018-12-24 13:57:45 89
原创 Subarray Sum Equals K
Subarray Sum Equals K 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 Input:nums = [1,1,1], k = 2 Output: 2 So...
2018-12-22 19:05:26 92
原创 Subarray Product Less Than K
Subarray Product Less Than K Your are given an array of positive integers nums. Count and print the number of (contiguous) subarrays where the product of all the elements in the subarray is less than...
2018-12-21 22:32:02 106
原创 Product of Array Except Self
Product of Array Except Self Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Example...
2018-12-19 10:13:14 62
原创 House Robber
House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that ...
2018-12-18 14:21:20 88
原创 Maximum Product of Three Numbers
Maximum Product of Three Numbers Given an integer array, find three numbers whose product is maximum and output the maximum product. Example Input: [1,2,3] Output: 6 Solution class Solution: d...
2018-12-17 13:42:10 102
原创 Maximum Product Subarray
Maximum Product Subarray Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example Input: [2,3,-2,4] Output: ...
2018-12-14 22:43:10 86
原创 Best Time to Buy and Sell Stock with Transaction Fee
Best Time to Buy and Sell Stock with Transaction Fee Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee repr...
2018-12-13 13:39:02 82
原创 Best Time to Buy and Sell Stock with Cooldown
Best Time to Buy and Sell Stock with Cooldown Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete ...
2018-12-12 21:13:55 102 1
原创 Best Time to Buy and Sell Stock IV
Best Time to Buy and Sell Stock IV Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most k t...
2018-12-12 18:09:07 79 1
原创 Best Time to Buy and Sell Stock III
Best Time to Buy and Sell Stock III Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most tw...
2018-12-11 00:13:04 91
原创 Best Time to Buy and Sell Stock II
Best Time to Buy and Sell Stock II Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many tra...
2018-12-06 21:49:02 89
原创 Best Time to Buy and Sell Stock
Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (i.e., buy one a...
2018-12-05 10:43:01 144
原创 Maximum Subarray
Maximum Subarray Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example Input: [-2,1,-3,4,-1,2,1,-5,4], Out...
2018-12-04 15:18:23 141
原创 Search Insert Position
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 dup...
2018-12-03 23:04:52 59
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人