Parameterize references to generic types. (#5078)

* chore: remove unused imports

* fix: parameterize references to generic types


---------

Co-authored-by: vil02 <65706193+vil02@users.noreply.github.com>
This commit is contained in:
SOZEL
2024-03-16 01:03:27 +07:00
committed by GitHub
parent ab371843ac
commit 192427a5d2
7 changed files with 9 additions and 10 deletions

View File

@ -51,13 +51,13 @@ class WordLadder {
* if the endword is there. Otherwise, will return the length as 0.
*/
public static int ladderLength(String beginWord, String endWord, List<String> wordList) {
HashSet<String> set = new HashSet(wordList);
HashSet<String> set = new HashSet<>(wordList);
if (!set.contains(endWord)) {
return 0;
}
Queue<String> queue = new LinkedList();
Queue<String> queue = new LinkedList<>();
queue.offer(beginWord);
int level = 1;