Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sudoku solver into a User Interface (UI) application #756

Open
wants to merge 732 commits into
base: revert-356-patch-1
Choose a base branch
from
Open
Changes from 2 commits
Commits
Show all changes
732 commits
Select commit Hold shift + click to select a range
b550f7f
Leetcode 23: Merge k sorted linked lists
Aarush2k1 Oct 5, 2022
4bcce70
minFallingPathSumTriangle.cpp created
thisabhijeet Oct 5, 2022
e4e2dbc
ninjaAndHisFriends.cpp created
thisabhijeet Oct 5, 2022
41bf33e
Create COINS - Bytelandian gold coins
AbhishekSrivastava-23 Oct 5, 2022
c003db5
Merge pull request #599 from thisabhijeet/ninjaAndHisFriends
gantavyamalviya Oct 5, 2022
16230cd
Merge pull request #597 from thisabhijeet/minFallingPathSumTriangle
gantavyamalviya Oct 5, 2022
d47cc86
Merge pull request #595 from thisabhijeet/maximumNonAdjacentSum
gantavyamalviya Oct 5, 2022
fec7629
Merge pull request #594 from thisabhijeet/longestCommonSubstring
gantavyamalviya Oct 5, 2022
e35fca6
Create Kruskal's_Algorithm.py
lokesh-7977 Oct 5, 2022
91028cc
CSES solutions
souravkhan12 Oct 5, 2022
1552a58
Merge branch 'codemistic:main' into main
namratabose32 Oct 5, 2022
97beecd
Sliding Window Median
Aarush2k1 Oct 5, 2022
8958a3b
lowestCommonAncestor.txt added
kokodeshinu Oct 5, 2022
f00b11d
minDepth.txt added
kokodeshinu Oct 5, 2022
1499771
rightSideView.txt added
kokodeshinu Oct 5, 2022
d2949d1
sortedArrayToBST.txt added
kokodeshinu Oct 5, 2022
42c453c
Create 0-1Knapsack.cpp
jashanwarraich Oct 5, 2022
603bee3
Create left view of tree.cpp
ayushkedia05 Oct 5, 2022
28c24a2
Maximum Sum Circular Subarray Java Solution
Aarush2k1 Oct 5, 2022
b9880e6
Add : Balanced Brackets and InfixToPostfix program in Java
tiger3768 Oct 5, 2022
872f479
add: N-Queen Backtrack solution
nilesh05apr Oct 5, 2022
fecb695
Added random pass gen and resolved issue #615
sohamdata Oct 5, 2022
3f1ba04
Create PolynomialAddition.cpp
Ansh-Kushwaha Oct 5, 2022
dd842fe
Improve Calculator.py
JYunth Oct 5, 2022
d62f68e
Merge branch 'main' of https://github.com/JYunth/Data-Structures-and-…
JYunth Oct 5, 2022
33d7b7e
Add files via upload
KBhushan07 Oct 5, 2022
9c11e2a
Add files via upload
KBhushan07 Oct 5, 2022
b1166b1
Binary Search in 2D Arrays (C++)
Ultimateutkarsh11 Oct 5, 2022
c61dde1
leetcode soln of remove Nth node from the End
Bluetoothworks Oct 5, 2022
4653a73
Implement_Trie
Oct 5, 2022
6fee8a1
Delete nodes in a binary tree
SegFault03 Oct 5, 2022
d6c2b67
Extract all the words from a string
SegFault03 Oct 5, 2022
fbe023f
added file for operations on arrays in c language
ola-nishant Oct 5, 2022
0b8acd6
stack using linked list
divyaa1511 Oct 5, 2022
c0aabf8
Added Detect a Cycle in a graph
MidhaShrey Oct 5, 2022
a199d05
Oct 5th : Add one row to tree
vishwajeet-hogale Oct 5, 2022
6983635
Create Geek and Strings.cpp
NarpatAanjana Oct 5, 2022
83ef52a
Pushkar Roy
Oct 5, 2022
ef619bd
added heap sort algo
vaibhav0726 Oct 5, 2022
1246dc7
Added Leetcode Problem 48 Name: Rotate Image(Medium) Url:https://le…
GaurishIIITNR Oct 5, 2022
471d67e
Added Leetcode Problem 48
GaurishIIITNR Oct 5, 2022
47866eb
Added Leetcode Problem 240
GaurishIIITNR Oct 5, 2022
e6328b8
Update 240_Search_a_2D_Matrix_II.cpp
GaurishIIITNR Oct 5, 2022
475026a
codeX1616-Code to override Object.equals() method in any java class
codeX1616 Oct 5, 2022
0d3412c
Removing compiled java class files
codeX1616 Oct 5, 2022
dcb07c6
Added Leetcode Problem 1404
GaurishIIITNR Oct 5, 2022
56843f7
Added Leetcode Problem 1404
GaurishIIITNR Oct 5, 2022
a52a88b
Create NCRcombination.c
AmanDekate1 Oct 5, 2022
3f3a88f
Added Leetcode String Problem 1404
GaurishIIITNR Oct 5, 2022
40a773a
Refactorised Java Folder
arpitghura Oct 5, 2022
39f1d20
Added Leetcode String Problem 443
GaurishIIITNR Oct 5, 2022
27d51b6
Merge branch 'codemistic:main' into main
PritomKarmokar Oct 5, 2022
1b897e1
Added code for Burning tree
jayesh-kumavat Oct 5, 2022
a22c537
Codeforces 49A in C++
aishalxgupta Oct 5, 2022
de5e39a
Added code for Implementing Linked List using Java
vaibhav0806 Oct 5, 2022
f42bc9e
Merge pull request #606 from kokodeshinu/lca
gantavyamalviya Oct 5, 2022
fbe060e
Merge pull request #607 from kokodeshinu/minDepth
gantavyamalviya Oct 5, 2022
1410aae
Merge pull request #608 from kokodeshinu/rightSideView
gantavyamalviya Oct 5, 2022
e8602c5
Merge pull request #609 from kokodeshinu/sortedArrayToBST
gantavyamalviya Oct 5, 2022
516287b
Create InsertionInABST.cpp
ShreyasiDebnath Oct 5, 2022
82b3b58
Merge pull request #544 from SwagsShivamOp/patch-1
gantavyamalviya Oct 5, 2022
b5b0094
Merge pull request #542 from itsokop/patch-2
gantavyamalviya Oct 5, 2022
9417d3c
Merge pull request #540 from itsokop/patch-1
gantavyamalviya Oct 5, 2022
e8b791b
Merge pull request #543 from itsokop/patch-3
gantavyamalviya Oct 5, 2022
6e12d08
Merge pull request #541 from Shubham2816/anagram_part
gantavyamalviya Oct 5, 2022
fc09098
Merge pull request #538 from itsokop/main
gantavyamalviya Oct 5, 2022
044a979
Merge pull request #536 from Mohammad-Palla/patch-1
gantavyamalviya Oct 5, 2022
364ec5e
Merge pull request #534 from DarkSpy25/main
gantavyamalviya Oct 5, 2022
d167f0e
Merge pull request #532 from Sudhir8787/patch-2
gantavyamalviya Oct 5, 2022
a6b087f
Merge pull request #529 from Rupesh-Piwal/main
gantavyamalviya Oct 5, 2022
bd31dc3
Merge pull request #528 from akshaykhatter/main
gantavyamalviya Oct 5, 2022
efe1211
Merge pull request #525 from PritomKarmokar/main
gantavyamalviya Oct 5, 2022
579a04e
Merge pull request #523 from i-see-pixels/patch-4
gantavyamalviya Oct 5, 2022
75d9184
Merge pull request #521 from i-see-pixels/patch-2
gantavyamalviya Oct 5, 2022
f243af1
Merge pull request #519 from pranava7/main
gantavyamalviya Oct 5, 2022
fad258f
Merge pull request #518 from HarshBhatt123/main
gantavyamalviya Oct 5, 2022
edb8ab4
Merge pull request #537 from JeetuGuptaa/patch-1
gantavyamalviya Oct 5, 2022
7a8677f
Merge pull request #535 from durgesh-4526/patch-1
gantavyamalviya Oct 5, 2022
6732032
Merge pull request #533 from Dibendu-G/main
gantavyamalviya Oct 5, 2022
d8e7286
Merge pull request #531 from Sudhir8787/patch-1
gantavyamalviya Oct 5, 2022
a7116d6
Merge pull request #526 from namratabose32/main
gantavyamalviya Oct 5, 2022
929cd42
Merge pull request #524 from priya-19054/main
gantavyamalviya Oct 5, 2022
9bb1036
Merge pull request #520 from precisecharmer/main
gantavyamalviya Oct 5, 2022
9dbbb12
Merge pull request #522 from i-see-pixels/patch-3
gantavyamalviya Oct 5, 2022
8385ce5
Merge pull request #554 from AdityaRaj-ar/main
gantavyamalviya Oct 5, 2022
c2e5e94
Merge pull request #575 from Sudhanshu-Purohit/main
gantavyamalviya Oct 5, 2022
e130b85
Merge pull request #573 from niharbansal02/main
gantavyamalviya Oct 5, 2022
bdc6a35
Merge pull request #569 from Saket109/main
gantavyamalviya Oct 5, 2022
d689e01
Merge pull request #567 from YOGENDERSS/main
gantavyamalviya Oct 5, 2022
0a43ca8
Merge pull request #566 from varunnitian/main
gantavyamalviya Oct 5, 2022
1def548
Merge pull request #564 from ladyinblack/ladyinblack
gantavyamalviya Oct 5, 2022
aaf1975
Merge pull request #563 from kanishka-28/main
gantavyamalviya Oct 5, 2022
d349592
Merge pull request #562 from AbhimanyuCODER/patch-2
gantavyamalviya Oct 5, 2022
15aa990
Merge pull request #559 from Rituraj-13/symmetric_tree
gantavyamalviya Oct 5, 2022
aedd970
Merge pull request #557 from aniruddho-mitra/patch-1
gantavyamalviya Oct 5, 2022
42eef4c
Merge pull request #555 from Pakhi-v/add-hacktoberfest
gantavyamalviya Oct 5, 2022
f1156f3
Merge pull request #550 from Shashank0271/lc1
gantavyamalviya Oct 5, 2022
3142239
Merge pull request #549 from aishalg/main
gantavyamalviya Oct 5, 2022
104063d
Merge pull request #548 from Yash9460/main
gantavyamalviya Oct 5, 2022
0da1b31
Merge pull request #547 from SwagsShivamOp/patch-4
gantavyamalviya Oct 5, 2022
a6babbd
Merge pull request #545 from SwagsShivamOp/patch-2
gantavyamalviya Oct 5, 2022
f73210d
Merge pull request #574 from mas-mis/patch-1
gantavyamalviya Oct 5, 2022
9985538
Merge pull request #572 from Sanjanabharadwaj25/TSP
gantavyamalviya Oct 5, 2022
9f73b82
Merge pull request #568 from sahanmndl/sahanmndl
gantavyamalviya Oct 5, 2022
ae4fc7a
Merge pull request #565 from siddharth3108/TowerofHanoi.java
gantavyamalviya Oct 5, 2022
5b8d7bc
Merge pull request #560 from sohanagashimani/main
gantavyamalviya Oct 5, 2022
fcbafd7
Merge pull request #558 from KryptonANSHU/Javascript-DSA
gantavyamalviya Oct 5, 2022
b7da6d0
Merge pull request #553 from rai-m47/main
gantavyamalviya Oct 5, 2022
2afd88f
Merge pull request #546 from SwagsShivamOp/patch-3
gantavyamalviya Oct 5, 2022
59104e4
Merge pull request #614 from tiger3768/stjava
gantavyamalviya Oct 5, 2022
f3f0754
Merge pull request #613 from nilesh05apr/nilesh
gantavyamalviya Oct 5, 2022
3f9ba9e
Merge pull request #612 from Aarush2k1/patch-3
gantavyamalviya Oct 5, 2022
7fbd1e9
Merge pull request #611 from ayushkedia05/main
gantavyamalviya Oct 5, 2022
e8c4e2b
Merge pull request #610 from jashanwarraich/patch-3
gantavyamalviya Oct 5, 2022
d1503be
Merge pull request #605 from Aarush2k1/patch-2
gantavyamalviya Oct 5, 2022
c361e9c
Merge pull request #604 from souravkhan12/main
gantavyamalviya Oct 5, 2022
d6e752b
Merge pull request #603 from Lokesh-Choudhary/patch-2
gantavyamalviya Oct 5, 2022
c44c3c2
Merge pull request #600 from AbhishekSrivastava-23/patch-1
gantavyamalviya Oct 5, 2022
e814ec1
Merge pull request #598 from unfixedbug/main
gantavyamalviya Oct 5, 2022
2a603d4
Merge pull request #596 from Aarush2k1/patch-1
gantavyamalviya Oct 5, 2022
6d5ba9e
Merge pull request #593 from sanu-020/main
gantavyamalviya Oct 5, 2022
0ab2793
Merge pull request #591 from geeky-auro/main
gantavyamalviya Oct 5, 2022
84c50fe
Merge pull request #589 from Aratrik-02/branch-Aratrik
gantavyamalviya Oct 5, 2022
2619e67
Merge pull request #588 from Abhishek-Mallick/leetcode4
gantavyamalviya Oct 5, 2022
719d0fe
Merge pull request #587 from GaurishIIITNR/main
gantavyamalviya Oct 5, 2022
2407416
Merge pull request #586 from swarup-0508/main
gantavyamalviya Oct 5, 2022
61e1592
Merge pull request #584 from 0901IT201046/main
gantavyamalviya Oct 5, 2022
d1c73b0
Merge pull request #582 from abhishekdey4444/main
gantavyamalviya Oct 5, 2022
9da3f02
Merge pull request #581 from DharmaWarrior/main
gantavyamalviya Oct 5, 2022
39a39fa
Merge pull request #580 from s-a-c-h-i-n/main
gantavyamalviya Oct 5, 2022
db7e87e
Merge pull request #579 from RR190701/main
gantavyamalviya Oct 5, 2022
fbdbb38
Merge pull request #576 from namita27/patch-1
gantavyamalviya Oct 5, 2022
de8e0b9
Merge pull request #616 from sohamdata/passGen
gantavyamalviya Oct 5, 2022
b514f70
Merge pull request #642 from ShreyasiDebnath/main
gantavyamalviya Oct 5, 2022
036bd81
Merge pull request #640 from vaibhav0806/my-branch
gantavyamalviya Oct 5, 2022
30759cd
Merge pull request #639 from Jayesh3734/main
gantavyamalviya Oct 5, 2022
f2988b7
Merge pull request #638 from GaurishIIITNR/PR5
gantavyamalviya Oct 5, 2022
a33de39
Merge pull request #637 from arpitghura/main
gantavyamalviya Oct 5, 2022
f9d41a3
Merge pull request #635 from AmanDekate1/patch-1
gantavyamalviya Oct 5, 2022
6a8c5ab
Merge pull request #634 from codeX1616/codeX1616/OverrideEqualsMethod
gantavyamalviya Oct 5, 2022
12a26d0
Merge pull request #633 from GaurishIIITNR/PR3
gantavyamalviya Oct 5, 2022
54f3455
Merge pull request #631 from vaibhav0726/patch-1
gantavyamalviya Oct 5, 2022
287db41
Merge pull request #629 from roy2pushkar/dsa
gantavyamalviya Oct 5, 2022
f256b14
Merge pull request #628 from NarpatAanjana/main
gantavyamalviya Oct 5, 2022
e7548cd
Merge branch 'main' into main
gantavyamalviya Oct 5, 2022
9210e8c
Merge pull request #627 from vishwajeet-hogale/main
gantavyamalviya Oct 5, 2022
89bf45b
Merge pull request #626 from MidhaShrey/main
gantavyamalviya Oct 5, 2022
45e34eb
Merge pull request #625 from divyaa1511/main
gantavyamalviya Oct 5, 2022
aedc265
Merge pull request #624 from ola-nishant/nishant
gantavyamalviya Oct 5, 2022
aa6b500
Merge pull request #623 from Vip2016-0/LeetCodeSol
gantavyamalviya Oct 5, 2022
ec20cc9
Merge pull request #622 from SegFault03/main
gantavyamalviya Oct 5, 2022
1bce71b
Merge pull request #621 from Ultimateutkarsh11/Utkarsh-Branch
gantavyamalviya Oct 5, 2022
ddf0258
Merge pull request #620 from Bluetoothworks/addcode
gantavyamalviya Oct 5, 2022
af2b074
Merge pull request #619 from KBhushan07/main
gantavyamalviya Oct 5, 2022
1d2ad71
Merge pull request #618 from JYunth/main
gantavyamalviya Oct 5, 2022
e702f36
Merge pull request #617 from Ansh-Kushwaha/patch-1
gantavyamalviya Oct 5, 2022
f81746e
Update README.md
gantavyamalviya Oct 6, 2022
12912fa
Create contributors.yml
gantavyamalviya Oct 6, 2022
141c22f
Update README.md
gantavyamalviya Oct 6, 2022
749ca26
docs(README): update contributors
github-actions[bot] Oct 6, 2022
e3a0413
docs(README): update contributors
github-actions[bot] Oct 6, 2022
3c97f65
Update README.md
gantavyamalviya Oct 6, 2022
bda2705
docs(README): update contributors
github-actions[bot] Oct 6, 2022
88ceff2
docs(README): update contributors
github-actions[bot] Oct 7, 2022
23e18f4
docs(README): update contributors
github-actions[bot] Oct 9, 2022
74db799
docs(README): update contributors
github-actions[bot] Oct 11, 2022
89c15a8
docs(README): update contributors
github-actions[bot] Oct 12, 2022
e4a0c92
docs(README): update contributors
github-actions[bot] Oct 15, 2022
0775771
docs(README): update contributors
github-actions[bot] Oct 20, 2022
1b3e09e
Update README.md
gantavyamalviya Oct 30, 2022
b3dc303
docs(README): update contributors
github-actions[bot] Nov 3, 2022
0c309b8
docs(README): update contributors
github-actions[bot] Nov 6, 2022
383919e
docs(README): update contributors
github-actions[bot] Nov 8, 2022
d17292e
docs(README): update contributors
github-actions[bot] Nov 10, 2022
d38f742
docs(README): update contributors
github-actions[bot] Dec 16, 2022
ce5db63
docs(README): update contributors
github-actions[bot] Dec 24, 2022
baa4263
docs(README): update contributors
github-actions[bot] Dec 27, 2022
035b4c3
docs(README): update contributors
github-actions[bot] Dec 28, 2022
a94abdf
docs(README): update contributors
github-actions[bot] Jan 3, 2023
773d108
docs(README): update contributors
github-actions[bot] Jan 18, 2023
193e35b
docs(README): update contributors
github-actions[bot] Jan 23, 2023
f3511a1
docs(README): update contributors
github-actions[bot] Jan 24, 2023
07f8a85
docs(README): update contributors
github-actions[bot] Feb 4, 2023
028c2bf
docs(README): update contributors
github-actions[bot] Feb 13, 2023
41d9101
docs(README): update contributors
github-actions[bot] Feb 15, 2023
fbf615f
docs(README): update contributors
github-actions[bot] Mar 2, 2023
44c95ae
docs(README): update contributors
github-actions[bot] Mar 3, 2023
92bfbf9
docs(README): update contributors
github-actions[bot] Mar 5, 2023
22bb2e1
docs(README): update contributors
github-actions[bot] Mar 7, 2023
84b6a89
docs(README): update contributors
github-actions[bot] Mar 11, 2023
881d8ab
docs(README): update contributors
github-actions[bot] Mar 13, 2023
2549b2f
docs(README): update contributors
github-actions[bot] Mar 16, 2023
5abac9b
docs(README): update contributors
github-actions[bot] Mar 24, 2023
816deb8
docs(README): update contributors
github-actions[bot] Mar 26, 2023
5e8f7a2
docs(README): update contributors
github-actions[bot] Apr 2, 2023
91ed764
docs(README): update contributors
github-actions[bot] Apr 7, 2023
cfaac9e
docs(README): update contributors
github-actions[bot] Apr 12, 2023
e275c29
docs(README): update contributors
github-actions[bot] Apr 29, 2023
9c93351
docs(README): update contributors
github-actions[bot] May 8, 2023
9c2b3e6
docs(README): update contributors
github-actions[bot] Jun 24, 2023
f893674
docs(README): update contributors
github-actions[bot] Jul 29, 2023
cb93523
docs(README): update contributors
github-actions[bot] Jul 31, 2023
9fdd0e0
docs(README): update contributors
github-actions[bot] Aug 8, 2023
681132e
docs(README): update contributors
github-actions[bot] Aug 11, 2023
a66c135
docs(README): update contributors
github-actions[bot] Aug 13, 2023
356fec0
docs(README): update contributors
github-actions[bot] Aug 19, 2023
ece47d6
docs(README): update contributors
github-actions[bot] Aug 20, 2023
16778bc
docs(README): update contributors
github-actions[bot] Aug 30, 2023
a21cc0b
docs(README): update contributors
github-actions[bot] Aug 31, 2023
fb819bc
docs(README): update contributors
github-actions[bot] Sep 1, 2023
d1b1d05
docs(README): update contributors
github-actions[bot] Sep 11, 2023
696676c
docs(README): update contributors
github-actions[bot] Sep 18, 2023
c733eba
docs(README): update contributors
github-actions[bot] Sep 22, 2023
d369c05
docs(README): update contributors
github-actions[bot] Oct 4, 2023
b4b46fc
docs(README): update contributors
github-actions[bot] Oct 28, 2023
44d44bf
docs(README): update contributors
github-actions[bot] Nov 15, 2023
2c51424
docs(README): update contributors
github-actions[bot] Nov 19, 2023
bdcf79d
docs(README): update contributors
github-actions[bot] Nov 29, 2023
f672d5d
docs(README): update contributors
github-actions[bot] Dec 4, 2023
40518ef
docs(README): update contributors
github-actions[bot] Jan 2, 2024
a7375a0
docs(README): update contributors
github-actions[bot] Jan 12, 2024
723ad1c
docs(README): update contributors
github-actions[bot] Jan 31, 2024
84dc84a
docs(README): update contributors
github-actions[bot] Feb 5, 2024
42b54ef
docs(README): update contributors
github-actions[bot] Feb 6, 2024
62bd760
docs(README): update contributors
github-actions[bot] Feb 11, 2024
bb967dc
docs(README): update contributors
github-actions[bot] Feb 28, 2024
a671ee2
docs(README): update contributors
github-actions[bot] Mar 17, 2024
ee53910
docs(README): update contributors
github-actions[bot] Apr 4, 2024
e6f6d4c
docs(README): update contributors
github-actions[bot] May 9, 2024
0237346
docs(README): update contributors
github-actions[bot] May 13, 2024
7260fec
docs(README): update contributors
github-actions[bot] May 28, 2024
94cdb32
docs(README): update contributors
github-actions[bot] May 31, 2024
e8f15b2
docs(README): update contributors
github-actions[bot] Jun 1, 2024
a6383a3
docs(README): update contributors
github-actions[bot] Jun 10, 2024
d66fb5c
docs(README): update contributors
github-actions[bot] Jul 3, 2024
a8dd8bc
docs(README): update contributors
github-actions[bot] Jul 4, 2024
6306e43
docs(README): update contributors
github-actions[bot] Jul 10, 2024
ff15c27
docs(README): update contributors
github-actions[bot] Jul 12, 2024
7242b2f
docs(README): update contributors
github-actions[bot] Jul 18, 2024
9743fe6
docs(README): update contributors
github-actions[bot] Jul 29, 2024
c0cd2ac
docs(README): update contributors
github-actions[bot] Aug 6, 2024
06ec62b
docs(README): update contributors
github-actions[bot] Aug 7, 2024
350a65b
docs(README): update contributors
github-actions[bot] Aug 20, 2024
a8184e3
docs(README): update contributors
github-actions[bot] Aug 24, 2024
20966c6
docs(README): update contributors
github-actions[bot] Aug 31, 2024
a03b9fb
docs(README): update contributors
github-actions[bot] Sep 4, 2024
d202442
docs(README): update contributors
github-actions[bot] Sep 10, 2024
f7572e4
docs(README): update contributors
github-actions[bot] Sep 19, 2024
6387625
docs(README): update contributors
github-actions[bot] Sep 25, 2024
a151deb
Merge pull request #1 from codemistic/main
Ansari-Shamaila Oct 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions 121 Leetcode/word-ladder-ii.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// BFS gives TLE if we store path while traversing because whenever we find a better visit time for a word, we have to clear/make a new path vector everytime.
// The idea is to first use BFS to search from beginWord to endWord and generate the word-to-children mapping at the same time.
// Then, use DFS (backtracking) to generate the transformation sequences according to the mapping.
// The reverse DFS allows us to only make the shortest paths, never having to clear a whole sequence when we encounter better result in BFS
// No string operations are done, by dealing with indices instead.



class Solution {
public:
bool able(string s,string t){
int c=0;
for(int i=0;i<s.length();i++)
c+=(s[i]!=t[i]);
return c==1;
}
void bfs(vector<vector<int>> &g,vector<int> parent[],int n,int start,int end){
vector <int> dist(n,1005);
queue <int> q;
q.push(start);
parent[start]={-1};
dist[start]=0;
while(!q.empty()){
int x=q.front();
q.pop();
for(int u:g[x]){
if(dist[u]>dist[x]+1){
dist[u]=dist[x]+1;
q.push(u);
parent[u].clear();
parent[u].push_back(x);
}
else if(dist[u]==dist[x]+1)
parent[u].push_back(x);
}
}
}
void shortestPaths(vector<vector<int>> &Paths, vector<int> &path, vector<int> parent[],int node){
if(node==-1){
// as parent of start was -1, we've completed the backtrack
Paths.push_back(path);
return ;
}
for(auto u:parent[node]){
path.push_back(u);
shortestPaths(Paths,path,parent,u);
path.pop_back();
}
}
vector<vector<string>> findLadders(string beginWord, string endWord, vector<string>& wordList) {
// start and end are indices of beginWord and endWord
int n=wordList.size(),start=-1,end=-1;
vector<vector<string>> ANS;
for(int i=0;i<n;i++){
if(wordList[i]==beginWord)
start=i;
if(wordList[i]==endWord)
end=i;
}

// if endWord doesn't exist, return empty list
if(end==-1)
return ANS;

// if beginWord doesn't exist, add it in start of WordList
if(start==-1){
wordList.emplace(wordList.begin(),beginWord);
start=0;
end++;
n++;
}
// for each word, we're making adjency list of neighbour words (words that can be made with one letter change)
// Paths will store all the shortest paths (formed later by backtracking)
vector<vector<int>> g(n,vector<int>()),Paths;

// storing possible parents for each word (to backtrack later), path is the current sequence (while backtracking)
vector<int> parent[n],path;

// creating adjency list for each pair of words in the wordList (including beginword)
for(int i=0;i<n-1;i++)
for(int j=i+1;j<n;j++)
if(able(wordList[i],wordList[j])){
g[i].push_back(j);
g[j].push_back(i);
}

bfs(g,parent,n,start,end);

// backtracking to make shortestpaths
shortestPaths(Paths,path,parent,end);
for(auto u:Paths){
vector <string> now;
for(int i=0;i<u.size()-1;i++)
now.push_back(wordList[u[i]]);
reverse(now.begin(),now.end());
now.push_back(wordList[end]);
ANS.push_back(now);
}
return ANS;
}
};