摘要: 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 阅读(2) 评论(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 阅读(1) 评论(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 阅读(1) 评论(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 阅读(1) 评论(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 阅读(2) 评论(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 阅读(2) 评论(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 阅读(1) 评论(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 阅读(1) 评论(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 阅读(2) 评论(0) 推荐(0) 编辑