198. House Robber
你是一名职业强盗,计划沿街抢劫房屋。
每个房子都藏有一定数量的钱,阻止你抢劫每个房子的唯一限制是相邻的房子有连接的安全系统,如果两个相邻的房子在同一晚被闯入,它会自动联系警察。
给定一个整数数组 nums,代表每个房子的金额,返回今晚在不报警的情况下可以抢劫的最大金额。
EX
Example 1:
Input: nums = [1,2,3,1]...
179. Largest Number
Given a list of non-negative integers nums, arrange them such that they form the largest number and return it.
Since the result may be very large, so you need to return a stri...
152. Maximum Product Subarray
Given an integer array nums, find a subarray that has the largest product, and return the product.
The test cases are generated so that the answer will fit in a 32-b...
146. LRU Cache
Design a data structure that follows the constraints of a Least Recently Used (LRU) cache.
Implement the LRUCache class:
LRUCache(int capacity) Initialize the LRU cache with posit...
87. Scramble String
We can scramble a string s to get a string t using the following algorithm:
If the length of the string is 1, stop.
If the length of the string is > 1, do the following:
...
85. Maximal Rectangle
Given a rows x cols binary matrix filled with 0’s and 1’s, find the largest rectangle containing only 1’s and return its area.
Ex
Example 1:
Input: matrix = [["1","0","1...
84. Largest Rectangle in Histogram
Given an array of integers heights representing the histogram’s bar height where the width of each bar is 1, return the area of the largest rectangle in the hist...