上一页 1 ··· 5 6 7 8 9 10 下一页
摘要: 公众号:爱写bug 给定一个数组 nums 和一个值 val ,你需要 原地 移除所有数值等于 val 的元素,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在 原地修改输入数组 并在使用 O(1) 额外空间的条件下完成。 元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。 Gi 阅读全文
posted @ 2019-07-02 13:26 爱写Bug 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 公众号:爱写bug 给定一个二进制数组, 计算其中最大连续1的个数。 Given a binary array, find the maximum number of consecutive 1s in this array. 示例 1: 注意: 输入的数组只包含 和 。 输入数组的长度是正整数,且 阅读全文
posted @ 2019-07-01 16:07 爱写Bug 阅读(223) 评论(0) 推荐(0) 编辑
摘要: Leetcode 344:Reverse String 反转字符串 公众号:爱写bug Write a function that reverses a string. The input string is given as an array of characters . Do not allo 阅读全文
posted @ 2019-06-30 16:36 爱写Bug 阅读(387) 评论(0) 推荐(0) 编辑
摘要: 公众号:爱写bug Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string 阅读全文
posted @ 2019-06-28 23:57 爱写Bug 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Leetcode 67:Add Binary(二进制求和) (python、java) Given two binary strings, return their sum (also a binary string). The input strings are both non empty an 阅读全文
posted @ 2019-06-27 16:17 爱写Bug 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 54:Spiral Matrix 螺旋矩阵 Given a matrix of m x n elements ( m rows, n columns), return all elements of the matrix in spiral order. 给定一个包含 m x n 个元素的矩阵( m 阅读全文
posted @ 2019-06-25 14:23 爱写Bug 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 118:Pascal's Triangle 杨辉三角 Given a non negative integer numRows , generate the first numRows of Pascal's triangle. 给定一个非负整数 numRows, 生成杨辉三角的前 numRows 阅读全文
posted @ 2019-06-25 14:22 爱写Bug 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 对角线遍历 给定一个含有 M x N 个元素的矩阵(M 行,N 列),请以对角线遍历的顺序返回这个矩阵中的所有元素,对角线遍历如下图所示。 Given a matrix of M x N elements (M rows, N columns), return all elements of the 阅读全文
posted @ 2019-06-05 14:23 爱写Bug 阅读(494) 评论(0) 推荐(0) 编辑
摘要: 加一 给定一个由 整数 组成的 非空 数组所表示的非负整数,在该数的基础上加一。 最高位数字存放在数组的首位, 数组中每个元素只存储一个数字。 你可以假设除了整数 0 之外,这个整数不会以零开头。 Given a non empty array of digits representing a no 阅读全文
posted @ 2019-06-03 22:41 爱写Bug 阅读(231) 评论(0) 推荐(0) 编辑
摘要: Leetcode747至少是其他数字两倍的最大数 在一个给定的数组 中,总是存在一个最大元素 。查找数组中的最大元素是否至少是数组中每个其他数字的两倍。如果是,则返回最大元素的索引,否则返回 1。 Given an array of integers , write a method that re 阅读全文
posted @ 2019-05-29 22:17 爱写Bug 阅读(143) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 下一页