![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
Lezvin
这个作者很懒,什么都没留下…
展开
-
Leetcode 198.打家劫舍 C#动态规划
题目描述:你是一个专业的小偷,计划偷窃沿街的房屋。每间房内都藏有一定的现金,影响你偷窃的唯一制约因素就是相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警。 给定一个代表每个房屋存放金额的非负整数数组,计算你 不触动警报装置的情况下 ,一夜之内能够偷窃到的最高金额。 using System; using System.Collections.Generic; public class Solution { public int Rob(int[] num原创 2020-11-29 22:33:58 · 129 阅读 · 0 评论 -
Leetcode 17. 电话号码的字母组合 C#回溯模板
result = [] def backtrack(路径, 选择列表): if 满足结束条件: result.add(路径) return for 选择 in 选择列表: 做选择 backtrack(路径, 选择列表) 撤销选择 public class Solution { List<string> res = new List<string>()..原创 2020-10-28 22:23:16 · 164 阅读 · 0 评论 -
Leetcode 11. 盛最多水的容器
双指针思想 public class Solution { public int MaxArea(int[] height) { if (null == height || height.Length < 2) return 0; int left = 0; int right = height.Length - 1; int area = 0; while (left < right)原创 2020-10-21 22:56:24 · 79 阅读 · 0 评论 -
Leetcode 21. 合并两个有序链表 C#解法
递归方法 public class ListNode { public int val; public ListNode next; public ListNode(int val = 0, ListNode next = null) { this.val = val; this.next = next; } } public class Solution { public ListNode MergeTwoLists(Li原创 2020-10-19 19:52:24 · 126 阅读 · 0 评论