Program To Find Square Root/Floor Of Square Root Of A Number | FREE DSA Course in JAVA | Lecture 64

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024
  • Given an integer N, compute and return the square root of N. If N is not a perfect square then return floor (sqrt (N)). Do not use SQRT function from the standard library.
    Note - Don't use the sort function from the standard library. Users are expected to solve this question with O (log (N)) time complexity.
    So this isn't another square root finding program and hence it was asked in companies like Amazon, Microsoft, VM ware, etc.
    We can solve this question using the binary search algorithm. It is because we have a sequentially increasing array of 1 to the number where we will find the square root.
    For eg, to find the square root of 16, it will surely be between 1,2,3, ............., 16.
    Moreover, this is also certain that square root will be available between 1 to 8 ie 1 to n/2.
    Hence we have to use the binary search algorithm to find the square root of a number.
    Let's see how we can write the logic for the program and also how we can find the floor of the square root if the number is not a perfect square.
    For more information, fill out this form: forms.gle/8eiU...
    or call us at 8884881203
    Facebook: / thetapacademy
    Instagram: / tapacademy_online
    Linkedin: / 73820805
    Website: www.thetapacad...​
    #java #javaprogramming #coding #coder #dsa #javatutorial #arrayjava

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

  • @NiteshSingh-tt8ex
    @NiteshSingh-tt8ex หลายเดือนก่อน

    Perfect explanation!!

  • @bavitasahu8378
    @bavitasahu8378 ปีที่แล้ว +3

    Your way of teaching is very good.

  • @jaikumarm6964
    @jaikumarm6964 9 หลายเดือนก่อน +1

    explanation is visually awesome teaching, clarity wow

  • @saran5671
    @saran5671 ปีที่แล้ว +6

    💥💥💥💥Congrats for Advance success of your channel ..I try to share to most of my friends

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

      Thank you so much 😀

  • @newvideos1123
    @newvideos1123 6 หลายเดือนก่อน

    Wonderful ❤❤❤

  • @jyothiswaroopa4904
    @jyothiswaroopa4904 11 หลายเดือนก่อน

    Very good explanation sir😊

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

    Wow amazing sir

  • @madeinscript4623
    @madeinscript4623 2 หลายเดือนก่อน

    Sir shall I return h instead of using res?

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

    Amazing brother wow

  • @jaikumarm6964
    @jaikumarm6964 9 หลายเดือนก่อน

    visually look like avatar 3.0 wow clear, awesome

  • @yarramneninikhil1299
    @yarramneninikhil1299 11 หลายเดือนก่อน

    Sir how you learned this dsa sir because your teaching is extraordinary sir

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

    if the testcase is 2 it returns 0 but it should be 1