当前位置:网站首页>Leetcode+ 51 - 55 retrospective and dynamic planning topics
Leetcode+ 51 - 55 retrospective and dynamic planning topics
2022-06-28 07:02:00 【Sauerkraut】
N Queen
Algorithm tags : Array 、 to flash back


Give a chess board , Yes n That's ok 、n Column Put it on this chessboard n A queen , The queen in chess can walk sideways , Walk upright , And you can walk sideways , Put it on this chessboard n A queen , Ask for this n Queens cannot be attacked against each other , There must be no two queens in the same line 、 The same column 、 Or on the same diagonal , It is required to output all schemes
Dynamic backtracking 、N queens problem _ Xiaoxuecai's blog -CSDN Blog
Just search directly , Observe some properties before searching :
Because all queens cannot attack each other , So there can only be one queen in each line , Due to the n A queen , Only total n That's ok , So there is just one queen in each line , Next, think about how to search all the schemes ?
Because only one queen can be placed in each line , So we can search line by line , First, let's see where the queen in the first row goes , On this basis ÿ
边栏推荐
- It will cost 700 yuan to realize this issue. Does anyone do it?
- Is it safe to open a stock trading account on your mobile phone?
- Design and practice of vivo sensitive word matching system
- JS of learning notes -- split(), replace(), join()
- File header information cross reference table
- YOLOv5增加小目标检测层
- FPM tool installation
- Reinforcement learning - grid world
- 【Rust日报】 2020-04-23 Rust 1.43.0 发布
- NDK 交叉编译
猜你喜欢

A small code editor can also run programs -- a summary of sublime Text3 running programs in various languages

代码没写错,渲染页面不显示原因

Boost the rising point | yolov5 combined with alpha IOU

图片按日期批量导入WPS表格

Libuv framework echo server C source code explanation (TCP part)

Libuv框架echo-server.c源码详解(TCP部分)

FPGA - 7 Series FPGA selectio -09- io of advanced logic resources_ FIFO

微信小程序编译页面空白bug的原因

什么是一致性哈希?可以应用在哪些场景?

Rn7302 three-phase electric quantity detection (based on STM32 single chip microcomputer)
随机推荐
Is it safe to open a stock trading account on your mobile phone?
AttributeError: 'callable_ iterator' object has no attribute 'next'
OPC 协议认识
Hungry for a long time, the brain will enter the "power saving mode"! Your senses are weakened and you can't see clearly
Causes of wechat applet compilation page blank bug
浮动与定位
4~20mA输入/0~5V输出的I/V转换电路
Teach you how to use UCOS
Rust FFI 编程 - libc crate
职场IT老鸟的几点小习惯
Server body 18: understanding and thinking of UDP reliable transmission (feeling from reading Yunfeng blog)
FPGA - 7 Series FPGA selectio -09- io of advanced logic resources_ FIFO
Create a gson object that formats the time zone. JSON parsing time formatting zoneddatetime
DOM parsing of XML file case code sentence by sentence analysis
Using interceptor and cache to complete interface anti brushing operation
普歌--三大基础排序,冒泡·选择·快速
Tryout title code
RN7302三相电量检测(基于STM32单片机)
pytorch RNN 学习笔记
Comprehensive analysis of real enterprise software testing process