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
The least frequent digits in n are 7, 2, and 5; each appears only once.
1425
1441
*/
1426
-
// console.log(getLeastFrequentDigit(n));
1442
+
console.log(getLeastFrequentDigit(n));
1443
+
1444
+
/**
1445
+
* 3488. Closest Equal Element Queries
1446
+
*
1447
+
* 2 array:
1448
+
* queries.
1449
+
* circular array: nums.
1427
1450
1451
+
* min distance between the element at index queries[i] and any other index j: nums[j] === nums[queries[i]]
1452
+
* same size aas queries where answer[i]
1453
+
* @param {number[]} nums
1454
+
* @param {number[]} queries
1455
+
* @return {number[]}
1456
+
*/
1457
+
varsolveQueries=function(nums,queries){
1458
+
1459
+
};
1460
+
letnums=[1,3,1,4,1,3,2],queries=[0,3,5];
1461
+
/*
1462
+
Output: [2,-1,3]
1463
+
Explanation:
1464
+
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.
1465
+
Query 1: The element at queries[1] = 3 is nums[3] = 4. No other index contains 4, so the result is -1.
1466
+
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