ICode9

精准搜索请尝试: 精确搜索
  • [LeetCode] 1301. Number of Paths with Max Score 最大得分的路径数目2022-05-23 13:01:16

    You are given a square board of characters. You can move on the board starting at the bottom right square marked with the character 'S'. You need to reach the top left square marked with the character 'E'. The rest of the squares are l

  • 残缺棋盘游戏2022-05-21 15:33:24

    分支算法 题意描述: 在2^k * 2^k的正方形棋盘上有一个缺口,这里可以认为是已经被填充了,要求给出使用三角板去填满这个棋盘的方案 #include <iostream> using namespace std; int amount,Board[100][100]; void Cover(int tr,int tc,int dr,int dc,int size) { int s,t;

  • LeetCode 130 Surrounded Regions 连通块DFS2022-05-16 21:01:14

    Given an m x n matrix board containing 'X' and 'O', capture all regions that are 4-directionally surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region. Solution 如

  • 37. 解数独2022-05-16 08:31:50

    37. 解数独 编写一个程序,通过填充空格来解决数独问题。 数独的解法需 遵循如下规则: 数字 1-9 在每一行只能出现一次。 数字 1-9 在每一列只能出现一次。 数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。(请参考示例图) 数独部分空格内已填入了数字,空白格用 '.' 表示。 示

  • 继承与多态练习2022-05-13 19:04:22

      public class Main{ public static void main(String args[]){ double all; Board board=new Board(); QingBoard qingBoard=new QingBoard(); board=qingBoard; LvBoard lvBoard=new LvBoard(); ChiBoard chiBoard=n

  • Leetcode 79. 单词搜索2022-05-10 03:00:34

    79. 单词搜索 - 力扣(LeetCode)    思路 还是回溯 func exist(board [][]byte, word string) bool { if len(board) < 1 || len(board[0]) > 6 || len(word) > 15 || len(word) < 1 { return false } var backTracking func(board [][]byte, x, y int, wordIndex int,

  • leetcode(c++)(DFS)2022-05-09 08:00:07

    #include <iostream> #include <stack> #include <vector> using namespace std; struct TreeNode{ TreeNode* left = nullptr, *right = nullptr; int val = 0; TreeNode(int v):val(v){} }; vector<int>inorder(TreeNode* root) {

  • 36. 有效的数独(hash表或位运算)2022-05-04 00:35:04

    36. 有效的数独 请你判断一个 9 x 9 的数独是否有效。只需要 根据以下规则 ,验证已经填入的数字是否有效即可。 数字 1-9 在每一行只能出现一次。 数字 1-9 在每一列只能出现一次。 数字 1-9 在每一个以粗实线分隔的 3x3 宫内只能出现一次。(请参考示例图)   注意:

  • LeetCode 0079 Word Search2022-04-26 07:00:38

    原题传送门 1. 题目描述 2. Solution 1 1、思路分析 使用递归遍历所有的位置, 2、代码实现 package Q0099.Q0079WordSearch; public class Solution { /* Here accepted solution based on recursion. To save memory I decided to apply bit mask for every visited

  • 找BUG 回溯法2022-04-24 02:01:11

      https://leetcode-cn.com/problems/word-search/ https://leetcode-cn.com/problems/ju-zhen-zhong-de-lu-jing-lcof/   func dfs(i, j, k int, board [][]byte, word string, used [][]int) bool { n := len(word) if k == n { return true } r := len(board) c :=

  • 剑指offer(12)2022-04-23 10:35:03

    剑指offer(12) 剑指 Offer 12. 矩阵中的路径 难度中等581 给定一个 m x n 二维字符网格 board 和一个字符串单词 word 。如果 word 存在于网格中,返回 true ;否则,返回 false 。 单词必须按照字母顺序,通过相邻的单元格内的字母构成,其中“相邻”单元格是那些水平相邻或垂直相邻的单元

  • 找Bug 用例2022-04-22 23:05:12

    https://leetcode-cn.com/problems/ju-zhen-zhong-de-lu-jing-lcof/ func exist(board [][]byte, word string) bool { n := len(word) r := len(board) c := len(board[0]) if n > r*c { return false } g := func(p, q, a, b int) bool { return (p == a &

  • 牛客华为机试HJ662022-04-21 07:32:18

    原题传送门 1. 问题描述 2. Solution import re import sys if sys.platform != "linux": file_in = open("input/HJ66.txt") sys.stdin = file_in command_map = { # ("reset", ""): "reset what", ("res

  • 牛客华为机试HJ442022-04-20 21:03:35

    原题传送门 1. 题目描述 2. Solution 1、思路 从上到下,从左到右遍历,每个空位置。在第一个空位置,随便填一个合法的数字,递归在填充后续空位置。如果,期间出现没有数字可以填的话,就回退到上一个位置,换下一个数字,继续。 import sys if sys.platform != "linux": file_in = open(

  • 剑指 Offer 12. 矩阵中的路径2022-04-16 01:03:29

    给定一个 m x n 二维字符网格 board 和一个字符串单词 word 。如果 word 存在于网格中,返回 true ;否则,返回 false 。单词必须按照字母顺序,通过相邻的单元格内的字母构成,其中“相邻”单元格是那些水平相邻或垂直相邻的单元格。同一个单元格内的字母不允许被重复使用。 例如,在下面的

  • leetcode 289. Game of Life2022-04-14 19:35:19

    class GameOfLife { public static void gameOfLife(int[][] board) { int[][] copy = new int[board.length][board[0].length]; for(int i = 0; i < board.length; i++){ for(int j = 0; j < board[i].length; j++){

  • 20214201 实验二 《Python程序设计》实验报告2022-04-06 00:04:31

    学号 2021-2022-2 《Python程序设计》实验二报告 课程:《Python程序设计》 班级: 2142 姓名: 刘嘉铭 学号: 20214201 实验教师:王志强 实验日期:2022年3月31日 必修/选修: 公选课 1.实验内容 设计并完成一个完整的应用程序,完成加减乘除模等运算,功能多多益善。 考核基本语法、判定语句、

  • C-(游戏)三子棋2022-04-01 13:31:54

    #pragma once //头文件的包含 #include<stdio.h> #include<stdlib.h> #include<time.h> //符号的定义 #define ROW 3 #define COL 3 //函数的声明 //初始化棋盘 void InitBoard(char board[ROW][COL],int row,int col); //打印棋盘的函数 void DisplayBoard(char board[ROW][C

  • GDUT-21级排位赛第一场 - G. Board Game(暴力搜索)2022-03-28 17:31:53

    题意 Feras bought to his nephew Saleem a new game to help him learning calculating. The game consists of a board with 4 rows and 4 columns with 16 cubes. Every cube has a number from 1 to 16. Let's define the power of a column as the sum of its element

  • 网易2022-03-27 23:01:12

    第二题:给你一串由小写字母构成的字符串,若字符串中两个字符相同,你可以将其标记并得分,得分为两个字符在字母表中的位置(从1开始)之和;若两个字符在字母表中相邻,也可以将其标记,例如ab相邻,yx相邻。每个字符只能被标记一次,返回所能取得的最高分。 import java.util.*; public class Main

  • 网易互联网笔试(3.27)2022-03-27 19:03:22

    网易互联网笔试(3.27) 网易互联网3.25日笔试,四道笔试题一道简答题,四道笔试题AK,简答题考察设计模式不会。 第一道题模拟使用单体技能和群体技能攻击怪物的场景、第二题字符串处理、第三题构造具有限制条件的完全二叉树、第四题动态规划问题。 题目 第一题 题意 给定两个怪,分别具有a

  • 力扣782——变为棋盘(数学模拟)2022-03-21 22:02:54

    解题思路 行与行之间的交换,不会改变列内关系,同样列列交换不会改变行; 因此,只会有两种行,两种列,并且每行每列1,0的个数相等(n为奇数时相差1); 并且这两行是相反的关系,只有这样交换完成后才会是两种相反的关系; 按此规则对矩阵进行合法判定; 交换次数即是与对应位置不等的个数/2; 之

  • 【剑指 Offer】 12. 矩阵中的路径 | 搜索与回溯2022-03-21 16:32:50

    文章目录 题目思路构造递归 代码 题目 思路 本题可以用搜索与回溯算法,本质上是递归,当遍历到当前元素时,递归遍历当前元素的上、左、下、右方元素 构造递归 1.边界条件 行列超出索引,返回false;当前元素与字符串单词不符,返回false;当前元素已经匹配到字符串单词最后一位,返回

  • lc 动态规划[含有一个记忆化搜索]2022-03-20 19:32:32

    1 动态规划 从背包问题开始: https://zhuanlan.zhihu.com/p/93857890 区间dp等等:https://oi-wiki.org/dp/interval/ 最重要的是,能够用dp数组,1到3维度一般,去表示最终结果,对于具体的题目,dp[i][j]表示什么意思,将成为解答的关键 很多动态规划都可以使用带记忆化的搜索去做 2 例题

  • bulletin board system2022-02-27 09:02:03

    A bulletin board system or BBS (also called Computer Bulletin Board Service, CBBS) is a computer server running software that allows users to connect to the system using a terminal program. Once logged in, the user can perform functions such as uploading

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有