Find Lucky Integer in an Array | Leetcode 1394
ฝัง
- เผยแพร่เมื่อ 15 ต.ค. 2024
- Find Lucky Integer in an Array
Leetcode problem number 1394
JAVA interview programming playlist:
• Interview Programming ...
#java #interviewquestions #leetcode - วิทยาศาสตร์และเทคโนโลยี
Well explained, mem 🎉 🤩
public int findLucky(int[] arr) {
int[] numbers = new int[501];
for (int j : arr) {
numbers[j]++;
}
for (int i = 500; i > 0; i--) {
if (i == numbers[i]) return i;
}
return -1; if we use this way then we don't have to use max func
nice explanation 😇👍
Very well explained ma'am nwz thankyou very much. 🙏🏽🤘🏾💯😂