JAVA Interview Questions | Technical Interview | Sort Array | Second Largest |

Поділитися
Вставка
  • Опубліковано 30 січ 2025

КОМЕНТАРІ • 8

  • @malingaraj7180
    @malingaraj7180 11 днів тому

    Sir india students need and necessary for this type of lectures

  • @krushnakantbhore
    @krushnakantbhore 10 днів тому

    This type of simple question really asked in interview in today's time 😂😂

  • @SunnySingh-mi8db
    @SunnySingh-mi8db 13 днів тому

    sir please continue coding question series for interview

  • @SunnySingh-mi8db
    @SunnySingh-mi8db 13 днів тому

    sor plz teach bubble.sort selection sort etc in simple manner

  • @bharatgadhave9307
    @bharatgadhave9307 13 днів тому

    We have sorted the array first then second largest value would be arr[arr.length-2] directly.....No need to run for loop again and if condition also...
    If I am wrong please correct me .

    • @tasneemsf3421
      @tasneemsf3421 12 днів тому

      Yes you can directly do it. But what if there is duplicate eg: 1,2,3,4,5,5....In this case if you directly return arr[are.length-2] it will return 5 which is wrong....So it's necessary to check if your arr[n-2] is equal to last element or not

  • @SATCHELOP
    @SATCHELOP 13 днів тому

    To find 2nd largest element madhi error yetay sir please check it with different elements in array