随笔分类 -  leetcode

1 2 3 4 5 ··· 15 下一页
摘要:Matrix Diagonal Sum Given a square matrix mat, return the sum of the matrix diagonals. Only include the sum of all the elements on the primary diagona 阅读全文
posted @ 2023-12-06 08:50 iyiluo 阅读(8) 评论(0) 推荐(0) 编辑
摘要:Three Consecutive Odds Given an integer array arr, return true if there are three consecutive odd numbers in the array. Otherwise, return false. Examp 阅读全文
posted @ 2023-12-06 08:49 iyiluo 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Number of Good Pairs Given an array of integers nums, return the number of good pairs. A pair (i, j) is called good if nums[i] == nums[j] and i < j. E 阅读全文
posted @ 2023-12-06 08:49 iyiluo 阅读(2) 评论(0) 推荐(0) 编辑
摘要:Maximum Product of Two Elements in an Array Given the array of integers nums, you will choose two different indices i and j of that array. Return the 阅读全文
posted @ 2023-12-06 08:49 iyiluo 阅读(2) 评论(0) 推荐(0) 编辑
摘要:Check If a Word Occurs As a Prefix of Any Word in a Sentence Given a sentence that consists of some words separated by a single space, and a searchWor 阅读全文
posted @ 2023-12-06 08:48 iyiluo 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Count Integers With Even Digit Sum Given a positive integer num, return the number of positive integers less than or equal to num whose digit sums are 阅读全文
posted @ 2023-12-06 08:48 iyiluo 阅读(9) 评论(0) 推荐(0) 编辑
摘要:Count Operations to Obtain Zero You are given two non-negative integers num1 and num2. In one operation, if num1 >= num2, you must subtract num2 from 阅读全文
posted @ 2023-12-06 08:48 iyiluo 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Get Maximum in Generated Array You are given an integer n. A 0-indexed integer array nums of length n + 1 is generated in the following way: nums[0] = 阅读全文
posted @ 2023-12-06 08:48 iyiluo 阅读(3) 评论(0) 推荐(0) 编辑
摘要:Find the Highest Altitude 思路一:直接遍历 public int largestAltitude(int[] gain) { int val = 0; int max = val; for (int i : gain) { val += i; max = Math.max( 阅读全文
posted @ 2023-12-06 08:47 iyiluo 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Check If Two String Arrays are Equivalent 思路一:把第一个数组入队列,然后遍历比较第二个数组 public boolean arrayStringsAreEqual(String[] word1, String[] word2) { Deque<Charac 阅读全文
posted @ 2023-12-06 08:47 iyiluo 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Pass the Pillow ``` There are n people standing in a line labeled from 1 to n. The first person in the line is holding a pillow initially. Every secon 阅读全文
posted @ 2023-07-22 21:13 iyiluo 阅读(8) 评论(0) 推荐(0) 编辑
摘要:Water Bottles ``` There are numBottles water bottles that are initially full of water. You can exchange numExchange empty water bottles from the marke 阅读全文
posted @ 2023-07-20 20:36 iyiluo 阅读(4) 评论(0) 推荐(0) 编辑
摘要:Defuse the Bomb ``` You have a bomb to defuse, and your time is running out! Your informer will provide you with a circular array code of length of n 阅读全文
posted @ 2023-07-05 23:10 iyiluo 阅读(8) 评论(0) 推荐(0) 编辑
摘要:Slowest Key ``` You have a bomb to defuse, and your time is running out! Your informer will provide you with a circular array code of length of n and 阅读全文
posted @ 2023-07-05 23:06 iyiluo 阅读(3) 评论(0) 推荐(0) 编辑
摘要:Find Numbers with Even Number of Digits Given an array nums of integers, return how many of them contain an even number of digits. Example 1: Input: n 阅读全文
posted @ 2023-05-18 20:26 iyiluo 阅读(6) 评论(0) 推荐(0) 编辑
摘要:Distribute Candies to People We distribute some number of candies, to a row of n = num_people people in the following way: We then give 1 candy to the 阅读全文
posted @ 2023-05-18 20:26 iyiluo 阅读(8) 评论(0) 推荐(0) 编辑
摘要:Partition Array Into Three Parts With Equal Sum Given an array of integers arr, return true if we can partition the array into three non-empty parts w 阅读全文
posted @ 2023-05-18 20:26 iyiluo 阅读(10) 评论(0) 推荐(0) 编辑
摘要:Number of Equivalent Domino Pairs Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (a == c a 阅读全文
posted @ 2023-05-18 20:25 iyiluo 阅读(11) 评论(0) 推荐(0) 编辑
摘要:Maximum Score After Splitting a String Given a string s of zeros and ones, return the maximum score after splitting the string into two non-empty subs 阅读全文
posted @ 2023-05-18 20:25 iyiluo 阅读(10) 评论(0) 推荐(0) 编辑
摘要:Check If it is a Straight Line You are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check i 阅读全文
posted @ 2023-05-18 20:25 iyiluo 阅读(10) 评论(0) 推荐(0) 编辑

1 2 3 4 5 ··· 15 下一页
点击右上角即可分享
微信分享提示