Amazing video sir ! You code in such simple way and explain it so well that any basic /intermediate base person can fully grasp the concept and learn coding.
I was very scary to make understand coding earlier. But once I started watching your videos, my thought process changed. I am very comfortable to understand your logics, I feel like "OH CODING IS SUCH SIMPLE" 😄🤣 Great Thank you Pavan sir..🤝🤝🙏🙏
why writing this much complex...i dont know............ we can write in this way too String s="yash is a good boy "; char comp='a'; int flag=0; for(int i=0;i
import java.util.Arrays; class OccrenceOfInputArray { public static void main(String[] args) { int arr[] = {1, 1, 2, 2, 3, 4, 5, 6, 8, 9}; int len = arr.length; System.out.println("Total length: " + len); String arrString = Arrays.toString(arr); // Replace '2' with an empty string and get the length int totalCount = len - arrString.replace("2", "").length(); System.out.println("Total count of 2: " + totalCount); } } sir, while im running this program after removing the 2 we got the output is 8, but here output is getting is: -18..........please clarify this doubt sir
Nice explanation however I am bit confused, as we count the spaces as well in index., So when we are replacing a with space, the space would still be counted. so not sure how did it work. Could you please explain the logic for that. Thank you