It is showing run-error in second test case,but correct answer in other two.https://ide.codingblocks.com/s/101126
Exist or not(Challenges: Hashing)
Hello,
Runtime error can occur due to the following reasons:
- Invalid memory access during run-time.
- Accessing linked list nodes that do not exist.
- Dividing by zero.
- Large allocation of memory together/Large Static Memory Allocation.
- Making a silly mistake.
What you have done is silly mistake.
Donβt worry, everybody does that. This will reduce over time.
So, coming back to your code.
There is a problem when you are declaring b[q] in your code.
Actually, you have not entered the value of q, but you are passing q as size of b[] array.
This is causing runtime error.
Solution:
cin>>q;
long long int b[q];
Hope, this would help.
Give a like, if you are satisfied.
1 Like