link of the problem : SPOJ.com - Problem GSS1
link to my solution : Ne2UYo - Online C++0x Compiler & Debugging Tool - Ideone.com
[simon@simon-laptop][21:00:14]
[~/devel/hackerrank/otherpeoples]>./compile-latest-cpp.sh
Compiling bhpra-blah.cpp
+ g++ -std=c++14 bhpra-blah.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG -fsanitize=undefined -ftrapv
bhpra-blah.cpp: In function βint buildTree(int, int*, int*, int, int)β:
bhpra-blah.cpp:17:20: warning: control reaches end of non-void function [-Wreturn-type]
segmentTree[v] = max(left,right);
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
+ set +x
Successful
[simon@simon-laptop][21:00:20]
[~/devel/hackerrank/otherpeoples]>echo "3
> -1 2 3
> 1
> 1 2" | ./a.out
bhpra-blah.cpp:3:5: runtime error: execution reached the end of a value-returning function without returning a value
1 Like
thanyou so much i got it also can you tell me how to debug like this
All the information you need is in that post