Question: codility ou are given an implementation of a function: classSolution{publicboolsolution(int[]A,intK);} his function, given a non-empty array A of N integers (sorted in nonlecreasing order) and
![codility ou are given an implementation of a function: classSolution{publicboolsolution(int[]A,intK);} his](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f392a5e7c36_82166f392a559c08.jpg)
codility
ou are given an implementation of a function: classSolution{publicboolsolution(int[]A,intK);} his function, given a non-empty array A of N integers (sorted in nonlecreasing order) and integer K, checks whether A contains numbers 1,2,, (every number from 1 to K at least once) and no other numbers. For example, given the following array A, and K=3 : A[]=1A[1]=1A[2]=2A[3]=3A[4]=3 The function should return true. For the following array A, and K=2 : A[]=1A[1]=1A[2]=3 the function should return false. The attached code is still incorrect for some inputs. Despite the error(s), the code may produce a correct answer for the example test cases. The goal of the exercise is to find and fix the bug(s) in the implementation. You can modify at most two lines
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
