随笔分类 -  leetcode

上一页 1 2 3 4 5 6 7 8 9 ··· 19 下一页

【leetcode_medium】289. Game of Life
摘要:leetcode_medium_array problem 289. Game of Life solution #1: code 注意: 1) 理解题意,将问题转换为数学可解问题; 2) 状态机的转换状态,以及最后的结果的关系; 3) 可以采用移位操作; /* 状态: 前一位表示下一代的状态,后一 阅读全文

posted @ 2020-09-15 21:54 鹅要长大 阅读(125) 评论(0) 推荐(0) 编辑

【leetcode_medium】287. Find the Duplicate Number
摘要:leetcode_medium_array problem 287. Find the Duplicate Number solution #1: 二分法; code solution #2: 快慢指针; code: solution #3: 位操作; code: 参考 1. leetcode_28 阅读全文

posted @ 2020-09-15 21:46 鹅要长大 阅读(141) 评论(0) 推荐(0) 编辑

【leetcode_easy】1539. Kth Missing Positive Number
摘要:leetcode_easy_array problem 1539. Kth Missing Positive Number solution #1: code 注意: 1) 数组的下标范围; 2) 超出数组范围的情况; solution #2: binary search; code 参考 1. l 阅读全文

posted @ 2020-09-15 21:43 鹅要长大 阅读(151) 评论(0) 推荐(0) 编辑

【leetcode_easy】1534. Count Good Triplets
摘要:leetcode_easy_array problem 1534. Count Good Triplets solution #1: Brute Force code solution #2: optimational Brute Force; code: solution #3: code 参考 阅读全文

posted @ 2020-09-15 21:12 鹅要长大 阅读(149) 评论(0) 推荐(0) 编辑

【leetcode_medium】238. Product of Array Except Self
摘要:leetcode_medium_array problem 238. Product of Array Except Self solution #1: 将乘积分为前后两部分相乘的结果; code solution #2: 空间优化; code: 参考 1. leetcode_238. Produc 阅读全文

posted @ 2020-09-15 21:03 鹅要长大 阅读(138) 评论(0) 推荐(0) 编辑

【leetcode_easy】1189. Maximum Number of Balloons
摘要:leetcode_easy_hashmap problem 1189. Maximum Number of Balloons solution #1: 哈希表; code solution #2:最小值函数; code 参考 1. leetcode_1189. Maximum Number of B 阅读全文

posted @ 2020-08-04 22:05 鹅要长大 阅读(106) 评论(0) 推荐(0) 编辑

【leetcode_medium】79. Word Search
摘要:leetcode_medium_array problem 79. Word Search solution #1: code 参考 1. leetcode_79. Word Search; 2. Grandyang; 完 阅读全文

posted @ 2020-08-04 22:02 鹅要长大 阅读(107) 评论(0) 推荐(0) 编辑

【leetcode_medium】80. Remove Duplicates from Sorted Array II
摘要:leetcode_medium_array problem 80. Remove Duplicates from Sorted Array II solution #1: code solution #2: code 参考 1. leetcode_80. Remove Duplicates from 阅读全文

posted @ 2020-08-04 22:01 鹅要长大 阅读(83) 评论(0) 推荐(0) 编辑

【leetcode_easy】299. Bulls and Cows
摘要:leetcode_easy_array problem 299. Bulls and Cows solution #1: code solution #2: code solution #3: code 参考 1. leetcode_299. Bulls and Cows; 2. Grandyang 阅读全文

posted @ 2020-08-04 22:00 鹅要长大 阅读(116) 评论(0) 推荐(0) 编辑

【leetcode_medium】371. Sum of Two Integers
摘要:leetcode_medium_array problem 371. Sum of Two Integers solution #1: code solution #2: one line code. code solution #3: loop; code 参考 1. leetcode_371.  阅读全文

posted @ 2020-08-04 21:57 鹅要长大 阅读(62) 评论(0) 推荐(0) 编辑

【leetcode_easy_array】1450. Number of Students Doing Homework at a Given Time
摘要:problem 1450. Number of Students Doing Homework at a Given Time solution #1: code 注意: 1. 细心coding; 参考 1. leetcode_1450. Number of Students Doing Homew 阅读全文

posted @ 2020-07-15 23:03 鹅要长大 阅读(82) 评论(0) 推荐(0) 编辑

【leetcode_easy_array】1295. Find Numbers with Even Number of Digits
摘要:problem 1295. Find Numbers with Even Number of Digits solution1: 计算数据的位数; code: solution2: 根据数据范围确定数据位数; code: 参考 1. leetcode_1295. Find Numbers with 阅读全文

posted @ 2020-07-15 23:01 鹅要长大 阅读(109) 评论(0) 推荐(0) 编辑

【leetcode_easy_array】1266. Minimum Time Visiting All Points
摘要:problem 1266. Minimum Time Visiting All Points solution1: Chebyshev Distance. code 参考 1. leetcode_1266. Minimum Time Visiting All Points; 完 阅读全文

posted @ 2020-07-15 23:00 鹅要长大 阅读(103) 评论(0) 推荐(0) 编辑

【leetcode_easy_array】1260. Shift 2D Grid
摘要:problem 1260. Shift 2D Grid solution1: 将矩阵看作一维矩阵,然后是数据循环移动; solution2:计算新的数据对应的下标,仍然使用二维矩阵进行移动; code 注意: 1. 数据是如何进行循环移动的; 2. 下标的重新计算; 参考 1. leetcode_1 阅读全文

posted @ 2020-07-15 22:58 鹅要长大 阅读(148) 评论(0) 推荐(0) 编辑

【leetcode_easy_array】1275. Find Winner on a Tic Tac Toe Game
摘要:problem 1275. Find Winner on a Tic Tac Toe Game 没看明白什么思路。。。看明白之后,发现最重要的是如何表示和存储每行每列和对角线是否在一条线上的状态。moves表示每一步骤所放置的位置坐标,A先B后; winner的状态共有六种,同一行三种、同一列三种、 阅读全文

posted @ 2020-07-15 22:56 鹅要长大 阅读(113) 评论(0) 推荐(0) 编辑

【leetcode_easy_array】1450. Number of Students Doing Homework at a Given Time
摘要:problem 1450. Number of Students Doing Homework at a Given Time 参考 1. leetcode_1450. Number of Students Doing Homework at a Given Time; 完 阅读全文

posted @ 2020-07-15 22:50 鹅要长大 阅读(86) 评论(0) 推荐(0) 编辑

【leetcode_easy_array】1287. Element Appearing More Than 25% In Sorted Array
摘要:problem 1287. Element Appearing More Than 25% In Sorted Array solution1: 累计元素数目; code: solution2: 滑窗处理; code: 注意理解题意: 1. 数组是非减数组; 2. 可以计数或者滑窗; 参考 1. l 阅读全文

posted @ 2020-07-15 22:47 鹅要长大 阅读(146) 评论(0) 推荐(0) 编辑

【leetcode_easy_array】1299. Replace Elements with Greatest Element on Right Side
摘要:problem 1299. Replace Elements with Greatest Element on Right Side solution1: 使用元素交换; code solution2: 使用最大值求解; code solution3: 使用多目运算; code 注意: 1. 末尾元 阅读全文

posted @ 2020-07-15 22:45 鹅要长大 阅读(119) 评论(0) 推荐(0) 编辑

【leetcode_easy_array】1512. Number of Good Pairs
摘要:problem 1512. Number of Good Pairs solution #1: 双层循环; code solution #2: 使用哈希表; code 注意: 1. 没明白哈希表计算res的方法; 参考 1. leetcode_1512. Number of Good Pairs; 阅读全文

posted @ 2020-07-15 22:41 鹅要长大 阅读(122) 评论(0) 推荐(0) 编辑

【leetcode_easy_array】1252. Cells with Odd Values in a Matrix
摘要:problem 1252. Cells with Odd Values in a Matrix 参考 1. leetcode_1252. Cells with Odd Values in a Matrix; 完 阅读全文

posted @ 2020-07-15 22:37 鹅要长大 阅读(60) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 ··· 19 下一页

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示