You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Explanation: The robot moves up once, and then down once. All moves have the same magnitude, so it ended up at the origin where it started. Therefore, we return true.
70
+
*/
71
+
letmoves="LL";
72
+
/*
73
+
Output: false
74
+
Explanation: The robot moves left twice. It ends up two "moves" to the left of the origin. We return false because it is not at the origin at the end of its moves.
Explanation: The robot moves up once, and then down once. All moves have the same magnitude, so it ended up at the origin where it started. Therefore, we return true.
1387
-
*/
1388
-
// let moves = "LL";
1389
-
/*
1390
-
Output: false
1391
-
Explanation: The robot moves left twice. It ends up two "moves" to the left of the origin. We return false because it is not at the origin at the end of its moves.
The least frequent digits in n are 7, 2, and 5; each appears only once.
1445
-
*/
1446
-
// console.log(getLeastFrequentDigit(n));
1447
1322
1448
1323
/**
1449
1324
* 3488. Closest Equal Element Queries
@@ -1500,14 +1375,12 @@ var solveQueries = function(nums, queries) {
1500
1375
}
1501
1376
1502
1377
};
1503
-
letnums=[1,3,1,4,1,3,2],queries=[0,3,5];
1378
+
// let nums = [1,3,1,4,1,3,2], queries = [0,3,5];
1504
1379
/*
1505
1380
Output: [2,-1,3]
1506
1381
Explanation:
1507
1382
Query 0: The element at queries[0] = 0 is nums[0] = 1. The nearest index with the same value is 2, and the distance between them is 2.
1508
1383
Query 1: The element at queries[1] = 3 is nums[3] = 4. No other index contains 4, so the result is -1.
1509
1384
Query 2: The element at queries[2] = 5 is nums[5] = 3. The nearest index with the same value is 1, and the distance between them is 3 (following the circular path: 5 -> 6 -> 0 -> 1).
0 commit comments