India’s Best Job Seekers and Training Platform Forums Java Problems set Write a function which returns the number of times…

  • Write a function which returns the number of times…

  • Akash 

    Administrator
    at

    Write a function which returns the number of times the digit “1” appears in a number which is generated from raising 11 to the Nth power where N is passed in as an input parameter. The range of N is 0 to 1,000.

    Be sure to unit test your solution.

    For instance, If N is 3, the number is 1331 and the function returns 2.

    If N is 5, the function returns 3.

    If N is 10, the function returns 1 and so on.

    public int solution(int N) { … }

Log in to reply.

Original Post
0 of 0 posts June 2018
Now
KodNest Training New Batch is starting on 02nd November 2020. Attend one week free demo classes.Register Now

New Report

Close