个人简介

Echo Blog


江湖无名 安心练剑
  • leetcode 46 204. Count Primes count-primes 素数的判断算法 Sieve of Eratosthenes
    204. Count Primes 给定一个整数 n,返回严格小于 n 的素数的个数。 Ex Example 1: Input: n = 10 Output: 4 Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7. Example 2: Input: n = 0 Output: 0 ...
    2020-01-23 02:09:32 | Algorithm
  • leetcode 45 198. House Robber DP/动态规划
    198. House Robber 你是一名职业强盗,计划沿街抢劫房屋。 每个房子都藏有一定数量的钱,阻止你抢劫每个房子的唯一限制是相邻的房子有连接的安全系统,如果两个相邻的房子在同一晚被闯入,它会自动联系警察。 给定一个整数数组 nums,代表每个房子的金额,返回今晚在不报警的情况下可以抢劫的最大金额。 EX Example 1: Input: nums = [1,2,3,1]...
    2020-01-23 02:09:32 | Algorithm
  • leetcode 44 179. Largest Number
    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...
    2020-01-23 02:09:32 | Algorithm
  • leetcode 43 152. Maximum Product Subarray 动态规划
    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...
    2020-01-23 02:09:32 | Algorithm
  • leetcode 42 150-Evaluate Reverse Polish Notation 逆波兰表达式
    什么是波兰表达式 我们日常的运算表达式通常是如下形式,这种成为中缀表达式,也就是运算符在运算数的中间。 这种表达式人类很容易识别,并根据其进行计算,但计算机识别这种表达式非常困难。 a + b * (c - d) + e/f 逆波兰表达式 概念 为什么叫逆波兰表达式呢? 首先是波兰数理学家 Jan Łukasiewicz 想到的这种表达数学算式的方法,其次相对于将运算符放在数...
    2020-01-23 02:09:32 | Algorithm
  • leetcode 41 LRU CACHE
    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...
    2020-01-23 02:09:32 | Algorithm
  • leetcode 87 Scramble String
    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: ...
    2020-01-23 02:09:32 | Algorithm
  • leetcode 85 maximal rectangle
    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...
    2020-01-23 02:09:32 | Algorithm