Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary Search Problems #357

Open
abhishek2s opened this issue Oct 27, 2024 · 2 comments
Open

Binary Search Problems #357

abhishek2s opened this issue Oct 27, 2024 · 2 comments

Comments

@abhishek2s
Copy link

No description provided.

@govindrajputFST
Copy link

Hello maintainer please assign me this issue @abhishek2s

@govindrajputFST
Copy link

This is the solution of binary search problem

class Solution {
public List prefixesDivBy5(int[] nums) {
ArrayList res=new ArrayList<> ();
int num=0;
int n = nums.length;

    for(int i=0;i<n;i++){
        num=(num*2+nums[i])%5;
        if(num%5==0){
            res.add(true);
        }else{
             res.add(false);
        }
    }
    return res;
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants