Sprinklr Interview experience Java Developer 2+ years experience

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 11

  • @bruteforce676
    @bruteforce676 11 месяцев назад

    Upper bound - lower bound can also be done in the last question

  • @syedmohdgulambaquer3577
    @syedmohdgulambaquer3577 8 месяцев назад

    You have 2.2 years of experience and you don’t know the time complexity of binary search and single iteration of for loop. I think you need to improve a lot. The pagination concept was also wrong and you can’t figure out what kind of indexing you should use to make search efficient. Good luck. Take it as a constructive feedback

  • @naveennaidu4855
    @naveennaidu4855 Год назад +1

    Do sum of array bro it will give count of 1's

    • @krishnakantsharma2201
      @krishnakantsharma2201  Год назад

      I will try 🙌

    • @ztrixx3280
      @ztrixx3280 Год назад +3

      Sum will take O(n) time.
      The problem can easily be solved using Binary Search(for finding the index of first occurence of 1) and then subtract the that index from length of array, this solution will only take O(log n), that's way better than O(n)

  • @NehaKumari-ih7ms
    @NehaKumari-ih7ms 11 месяцев назад

    How you go so much interview I need your help to get interviews

  • @ChandanKumar-xd1tg
    @ChandanKumar-xd1tg Год назад +1

    public class CountOnes {
    public static void main(String[] args) {
    String binarySequence = "000001111";
    int result = countOnes(binarySequence);
    System.out.println("The number of 1s in the binary sequence is: " + result);
    }
    static int countOnes(String binarySequence) {
    int count = 0;
    for (char digit : binarySequence.toCharArray()) {
    if (digit == '1') {
    count++;
    }
    }
    return count;
    }
    }