Skip to content

Commit 05362c8

Browse files
Update README.md
1 parent 158c8de commit 05362c8

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

algorithm-1/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,41 @@ Katkıda bulunmak istiyorsanız, lütfen aşağıdaki adımları takip edin:
1313

1414
## SORU
1515

16+
On an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty square represented by 0. A move consists of choosing 0 and a 4-directionally adjacent number and swapping it.
17+
18+
The state of the board is solved if and only if the board is [[1,2,3],[4,5,0]].
19+
20+
Given the puzzle board board, return the least number of moves required so that the state of the board is solved. If it is impossible for the state of the board to be solved, return -1.
21+
22+
![image](https://user-images.githubusercontent.com/33912144/236757486-1de6785a-06a7-4d53-a7cb-3684a55b99b7.png)
23+
Girdi: board = [[1,2,3],[4,0,5]]
24+
Çıktı: 1
25+
Açıklama: Bir hamlede 0 ve 5'i değiştirin.
26+
27+
![image](https://user-images.githubusercontent.com/33912144/236757638-1fe80d5a-d079-4c35-a2cb-0b31c292edf6.png)
28+
Girdi: board = [[1,2,3],[5,4,0]]
29+
Çıktı: -1
30+
Açıklama: Hiçbir hamle sayısı tahtayı çözülmüş hale getirmeyecektir.
31+
32+
![image](https://user-images.githubusercontent.com/33912144/236757814-d4944172-e8a2-4e91-b46b-e0cbfd36d06f.png)
33+
Girdi: board = [[4,1,2],[5,0,3]]
34+
Çıktı: 5
35+
Açıklama: 5, tahtayı çözen en küçük hamle sayısıdır.
36+
Bir örnek yol:
37+
38+
1. hamleden sonra: [[4,1,2],[5,0,3]]
39+
2. hamleden sonra: [[4,1,2],[0,5,3]]
40+
3. hamleden sonra: [[0,1,2],[4,5,3]]
41+
4. hamleden sonra: [[1,0,2],[4,5,3]]
42+
5. hamleden sonra: [[1,2,0],[4,5,3]]
43+
6. hamleden sonra: [[1,2,3],[4,5,0]]
44+
45+
Kısıtlamalar:
46+
47+
board.length == 2
48+
board[i].length == 3
49+
0 <= board[i][j] <= 5
50+
Her board[i][j] değeri benzersizdir.
1651

1752
## Lisans
1853

0 commit comments

Comments
 (0)