Here we are able to pass count as a parameter and it works,
But in many cases when I tried passing count as parameter it didnt worked and I had to take a static count ,
So when can i pass count as a parameter and when not
Please explain
Passing count as parameter
Hey @bhavik911
its depend on Question.
if you need to return count from recursion, you can do that without passing parameter . In any case last me count me return krna hoga. Don’t use count as a parameter
But we have used count as a parameter in all indices problem
But tum print kr rahe its Fine
if(arr[lo]==target){
System.out.print(lo + " ");
}
you need to return count from recursion, Don’t use count as a parameter
So if the return is void I can take count as parameter but not when I have to return int , is this right??
Please mark your doubts as resolved in your course’s. and rate full