You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"C:\Program Files\Java\jdk-19\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.2.4\lib\idea_rt.jar=50036:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.2.4\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath E:\data_structre_algorithm\out\production\Dsa_pw SearchInfyniteArray Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 29 out of bounds for length 19 at SearchInfyniteArray.ans(SearchInfyniteArray.java:14) at SearchInfyniteArray.main(SearchInfyniteArray.java:6)
#1233
Open
nri2020 opened this issue
Dec 19, 2023
· 2 comments
int [] arr = {1,2,3,4,5,6,7,8,9,11,22,33,35,44,55,66,77,88,91};
int target = 88;
"C:\Program Files\Java\jdk-19\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.2.4\lib\idea_rt.jar=50036:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2023.2.4\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath E:\data_structre_algorithm\out\production\Dsa_pw SearchInfyniteArray
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 29 out of bounds for length 19
at SearchInfyniteArray.ans(SearchInfyniteArray.java:14)
at SearchInfyniteArray.main(SearchInfyniteArray.java:6)
it is because you have passed a finite length array so when the index value goes out of bound(greater then the length of array) it throws the above error, the given code in the repository is for infinite length array.
int [] arr = {1,2,3,4,5,6,7,8,9,11,22,33,35,44,55,66,77,88,91};
int target = 88;
The text was updated successfully, but these errors were encountered: