摘要:
给定一个整数数组Arr,求解数组中连续的不相邻元素的和的最大值。例如:对于数组中的元素A1,A2,A3,A4,则需要判断A1+A3,A1+A4,A2+A4中的最大值即为所求。 状态转移方程:dp[i] = max(dp[i - 2], dp[i - 3]) + num[i] 其中,dp[i]表示打劫 阅读全文
posted @ 2022-11-23 23:09
MarkLeeBYR
阅读(32)
评论(0)
推荐(0)
摘要:
Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Not 阅读全文
posted @ 2022-11-23 22:56
MarkLeeBYR
阅读(51)
评论(0)
推荐(0)
摘要:
剑指offer 数组中出现超过一半的数字 https://www.cnblogs.com/MarkLeeBYR/p/9775097.html 阅读全文
posted @ 2022-11-21 23:15
MarkLeeBYR
阅读(25)
评论(0)
推荐(0)
摘要:
剑指offer 两个链表公共节点 https://www.cnblogs.com/MarkLeeBYR/p/9774276.html 阅读全文
posted @ 2022-11-21 23:11
MarkLeeBYR
阅读(35)
评论(0)
推荐(0)
摘要:
剑指offer 旋转数组的最小值 https://www.cnblogs.com/MarkLeeBYR/p/9777244.html 阅读全文
posted @ 2022-11-21 10:09
MarkLeeBYR
阅读(29)
评论(0)
推荐(0)
摘要:
Given an integer array nums, find a subarray that has the largest product, and return the product. The test cases are generated so that the answer wil 阅读全文
posted @ 2022-11-20 23:12
MarkLeeBYR
阅读(35)
评论(0)
推荐(0)
摘要:
Sort a linked list in O(n log n) time using constant space complexity. //利用归并排序的思想 public ListNode sortList(ListNode head) { if (head == null || head. 阅读全文
posted @ 2022-11-20 22:38
MarkLeeBYR
阅读(41)
评论(0)
推荐(0)
摘要:
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the 阅读全文
posted @ 2022-11-20 17:18
MarkLeeBYR
阅读(41)
评论(0)
推荐(0)
摘要:
剑指offer 链表环入口 https://www.cnblogs.com/MarkLeeBYR/p/9773649.html 阅读全文
posted @ 2022-11-20 17:14
MarkLeeBYR
阅读(33)
评论(0)
推荐(0)
摘要:
Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequ 阅读全文
posted @ 2022-11-20 16:22
MarkLeeBYR
阅读(41)
评论(0)
推荐(0)
浙公网安备 33010602011771号