Find Lucky Integer in an Array | Leetcode 1394

แชร์
ฝัง

ความคิดเห็น • 4

  • @x-menofficial007
    @x-menofficial007 ปีที่แล้ว +1

    Well explained, mem 🎉 🤩

  • @chinmayjain9705
    @chinmayjain9705 ปีที่แล้ว +2

    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

  • @chinmayjain9705
    @chinmayjain9705 ปีที่แล้ว

    nice explanation 😇👍

  • @naskinzomb3645
    @naskinzomb3645 ปีที่แล้ว

    Very well explained ma'am nwz thankyou very much. 🙏🏽🤘🏾💯😂