Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4020720
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:15:48+00:00 2026-05-20T10:15:48+00:00

This is from an old test that I’m using to study. I need to

  • 0

This is from an old test that I’m using to study.
I need to write a recursive method that returns the number of zeroes on the int[] from position 0 and right.
given int numberOfZeroes(int[] a, int right);

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:15:49+00:00Added an answer on May 20, 2026 at 10:15 am

    This assumes right < a.length

    int numberOfZeroes(int[] a, int right) {
      if(right < 0) {  // We've gone through all indices
        return 0;  // So we don't want to recurse anymore
      } else if(a[right] == 0) {  // The current index has a zero
        return 1 + numberOfZeroes(a, right - 1); // Call the function, moving left one. Add one to the returned count since we found a zero
      } else {  // The current index does not have a zero
        return numberOfZeroes(a, right - 1); // Call the function, moving left one. We don't add anything since we didn't find a zero
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to work with an old repository, whose db/format contains 2 From this
I'm studying for an exam, and this is a problem from an old test:
I'm trying to illustrate a doubly linked list problem. this is from an old
I have this old question but no answer works for me from online, the
Say I write this: from subprocessing import Popen, STDOUT, PIPE p = Popen([myproc], stderr=STDOUT,
I'm using Objective-C Distributed Objects (DO) to share data from one application (that collects
I have two tables with some ID's and I need a query that returns
I'm using C# and .NET 3.5, trying to import some data from old dbf
I have a complex database conversion console app that reads from an old database,
We are converting our application from using Sql Server Express (let's call this version

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.