ARTS打卡第5周

A: Unique Paths II  Medium

A robot is located at the top-left corner of a m x n grid (marked ‘Start‘ in the diagram below).

The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked ‘Finish‘ in the diagram below).

Now consider if some obstacles are added to the grids. How many unique paths would there be?

An obstacle and empty space is marked as 1 and 0 respectively in the grid.

解析:一个机器人从起始位置到终点,只能选择向下或者向右,不能向左或者向上,一个有多少种不同的路线,遇到障碍时无法通过

解题思路:使用动态规划的方式来进行题目的解答,可以画出相应的网格图

4行4列时:

当行数为1时:机器人只能向右走,列数为i,每个array[0][i]的唯一路线和都是1

当列数为1时:机器人只能向下走,行数为i,每个array[i][0]的唯一路线和都是1

对应不同的m行和n列都有array[i][j]=array[i-1][j]+array[i][j-1],指定的终点的可能的唯一路线和是终点在左边一位的可能性之和加上终点在上边一位的可能性之和

当遇到阻碍时对应阻碍点的可能性为0,依照这样的思路可以得出具体的答案

解题方法:https://leetcode.com/submissions/detail/223942453/  63题

https://leetcode.com/submissions/detail/223909257/   62题

R:https://blog.usejournal.com/top-50-dynamic-programming-practice-problems-4208fed71aa3  简要描述了动态规划的含义,并列举了50个动态规划的问题

动态规划是一种解决复杂问题的方法,它将复杂问题分解为一系列更简单的子问题,每个子问题只解决一次,并使用基于内存的数据结构(数组、映射等)存储它们的解决方案。

每个子问题解决方案都以某种方式进行索引,通常基于其输入参数的值,以便于查找。因此,下次出现相同的子问题时,不必重新计算它的解,

只需查找以前计算过的解,从而节省计算时间。这种存储子问题的解决方案而不是重新计算它们的技术称为记忆。将处理对应子问题的思路提炼成对应的

公式进行之后问题的结果的推导。

T:java如何设计一个接收文件的接口:对应接口的参数使用:

接收单一文件:@RequestParam("pics") CommonsMultipartFile pics

接收多文件:@RequestParam("pics") CommonsMultipartFile[] pics

其中的@RequestParam("pics") 声明接收的文件或者文件集合的参数名,需要对应,不对应将无法接收文件

S:左耳听风《面对枯燥和量大的知识》,讲述了如何面对枯燥和量大的知识,枯燥的知识通常是比较难或者比较理论的知识,需要找下应用场景,带着问题学习,多实践多踩坑,

认真阅读文档可以避免一些坑,通过多种途径学习一个东西,印象更为深刻。

原文地址:https://www.cnblogs.com/wujunjie-Blog/p/10816870.html

时间: 2024-08-30 16:10:44

ARTS打卡第5周的相关文章

ARTS打卡计划第一周-Review

本周分享的文章来自于medium的 Testing Best Practices for Java + Spring Apps 这个文章主要讲的是java测试的一些最佳实践 1.避免函数返回void,返回void不利于写单元测试,因为返回void不知道方法执行的内部情况 2.使用有意义的 assertions,可以使用  https://google.github.io/truth/ 类库 3.记得测试异常 4.可以使用变量进行多次测试 5.使用Mockito进行mock测试 原文地址:http

ARTS打卡第三周

Algorithm 题目描述 Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct. Example 1: Input: [1,2,3

ARTS打卡计划第二周-Review

本周review的文章是:https://medium.com/@hakibenita/optimizing-django-admin-paginator-53c4eb6bfca3 改篇文章的题目是:Optimizing Django Admin Paginator,How we finally made Django admin fast for large tables. django分页的时候,大部分时间都会消耗在求count上,本篇文章提到了几点用于提升大表分页的方法: 1.重写默认的分

ARTS打卡计划第二周-Algorithm

665. 非递减数列  https://leetcode-cn.com/problems/non-decreasing-array/ 给定一个长度为 n 的整数数组,你的任务是判断在最多改变 1 个元素的情况下,该数组能否变成一个非递减数列. 我们是这样定义一个非递减数列的: 对于数组中所有的 i (1 <= i < n),满足 array[i] <= array[i + 1]. class Solution { public boolean checkPossibility(int[]

ARTS打卡第1周

A:Add Two Numbers Medium You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.You ma

ARTS打卡第4周

A:Merge Intervals Medium Given a collection of intervals, merge all overlapping intervals. 解析:对给定的一个对象集合进行处理,将对象集合中存在交集的对象进行合并,行成一个新的集合 思路:优先将对象集合进行处理,将起始位置一致的对象先进行合并,返回一个map记录起始位置和对应的对象, 将对象进行排序,分析当前对象与下一对象的关系,判断下一位置的起始位置是否包含在当前的对象中,包含则合并对象的范围,不存在则新

ARTS打卡第6周

A:  Subsets 题目:Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. 题意:求一个不重复的数组的所有不重复的子集 思路:使用递归的方式求解,在对一个长度为n的数组求所有不重复的子集时:先记录当前的结果集,循环调用n次,对应的情况有是否记录当前位置的值,

ARTS打卡第3周

A:Rotate Image     Medium You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOTallocate ano

ARTS打卡计划第一周

Algorithms: https://leetcode-cn.com/problems/two-sum/ Review: https://www.infoq.cn/article/EafgGJEtqQTAa_0sP62N Q版本,慢慢雏形已经出来. Tips: c++11 : 1.nullptr   是一种特殊类型的字面值, null 指针常量,可以转换成任意其他指针类型,是一个关键字.之前的NULL是一个预处理变量,需要单独引入头文件cstdlib,其值也是0. #ifdef __cplus