- 博客(7)
- 资源 (1)
- 收藏
- 关注
原创 Sorting And Array LEETCODE-100-DAY4
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 colors in the order red, white and blue. Here, we will use the integers 0, 1, and 2 to represent the color
2020-06-30 22:03:16 3244
原创 Bitwise And Array LEETCODE-100-DAY3
66. Plus One Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit. You ma
2020-06-29 09:46:49 275
原创 String-LEETCODE-100-DAY2
186.reverse-words-in-a-string-ii) 给定一个字符串,逐个翻转字符串中的每个单词。 示例 1: 输入: "the sky is blue" 输出: "blue is sky the" 时间复杂度为O(n),因为整体遍历和单个单词遍历的的复杂度都为n,r从0走到最右的复杂度也是n,这样就是3n的复杂度,忽略指数,即可得到O(n) 空间复杂度为O(1) //先整体翻转,然后使用双指针法,将r指向单词后的空格部分,再逐一翻转单词 class Solution { pub
2020-06-28 23:57:00 666
原创 【吉比特面试题】删掉重复的字符串
题目描述 牛牛有一个由小写字母组成的字符串s,在s中可能有一些字母重复出现。比如在"banana"中,字母’a’和字母’n’分别出现了三次和两次。 但是牛牛不喜欢重复。对于同一个字母,他只想保留第一次出现并删除掉后面出现的字母。请帮助牛牛完成对s的操作。 字符串可能会有大小之分。 题解 第一种方法 遍历两个数组用,用charAt()判断是否重复,如果重复就删掉第二个数组中的重复元素,然后J- - 第二种方法(作者:就这些吗) 可以用HashSet去重 import java.util.*; publ
2020-06-27 14:55:15 435
原创 [微软面试题]01.07旋转矩阵
面试题 01.07. 旋转矩阵 给你一幅由 N × N 矩阵表示的图像,其中每个像素的大小为 4 字节。请你设计一种算法,将图像旋转 90 度。 不占用额外内存空间能否做到? 示例 1: 给定 matrix = [ [1,2,3], [4,5,6], [7,8,9] ], 原地旋转输入矩阵,使其变为: [ [7,4,1], [8,5,2], [9,6,3] ] 示例 2: 给定 matrix = [ [ 5, 1, 9,11], [ 2, 4, 8,1
2020-06-27 14:52:34 316
原创 图的BFS模板请看这里!!![力扣]1162.地图分析、542. 01矩阵
1162. 地图分析 你现在手里有一份大小为 N x N 的「地图」(网格) grid,上面的每个「区域」(单元格)都用 0 和 1 标记好了。其中 0 代表海洋,1 代表陆地,请你找出一个海洋区域,这个海洋区域到离它最近的陆地区域的距离是最大的。 我们这里说的距离是「曼哈顿距离」( Manhattan Distance):(x0, y0) 和 (x1, y1) 这两个区域之间的距离是&n
2020-06-27 14:49:12 283
原创 力扣100题 第一天 二分查找与链表
Author : pukka 74. Search a 2D Matrix Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right. The first integer of each row is greater than th
2020-06-27 13:55:22 292
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人