随笔分类 - leetcode
摘要:给你一个长度为 n 的整数数组 nums 和一个整数 p,请你选出一个 非空 的子数组使得该子数组元素和对 p 的余数是 0,但不能选出全部元素。 计算这个子数组的长度,如果不存在这样的子数组,返回 -1。 一个数组的 子数组 定义为一个由数组中零个或者更多个连续元素组成的数组。 示例 1: 输入:
阅读全文
摘要:问题描述 在一个 m*n 的棋盘的每一格都放有一个礼物,每个礼物都有一定的价值(价值大于 0)。你可以从棋盘的左上角开始拿格子里的礼物,并每次向右或者向下移动一格、直到到达棋盘的右下角。给定一个棋盘及其上面的礼物的价值,请计算你最多能拿到多少价值的礼物? 示例 1: 输入: [ [1,3,1], [
阅读全文
摘要:62. Unique Paths A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down
阅读全文
摘要:678. Valid Parenthesis String Given a string containing only three types of characters: '(', ')' and '*', write a function to check whether this strin
阅读全文
摘要:171. Excel Sheet Column Number Given a column title as appear in an Excel sheet, return its corresponding column number. For example: Example 1: Examp
阅读全文
摘要:172. Factorial Trailing Zeroes Given an integer n, return the number of trailing zeroes in n!. Example 1: Example 2: Note: Your solution should be in
阅读全文
摘要:75. Sort Colors Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the
阅读全文
摘要:55. Jump Game Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represe
阅读全文
摘要:17. Letter Combinations of a Phone Number Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number
阅读全文
摘要:Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Exam
阅读全文
摘要:3. Longest Substring Without Repeating Characters Given a string, find the length of the longest substring without repeating characters. Examples: Giv
阅读全文
摘要:73. Set Matrix Zeroes Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place. Example 1: Example 2: Follow up: A
阅读全文
摘要:49. Group Anagrams Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","e
阅读全文
摘要:15. 3Sum Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gi
阅读全文
浙公网安备 33010602011771号