Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdded Sparse Table for range query #812
Conversation
Hi @arpanmukherjee, thanks for the code! Please fix the cpplint failure according to
|
@@ -30,21 +29,19 @@ void buildTable(int n) { | |||
if (curLen == 1) | |||
table[i][j] = A[j]; | |||
else | |||
table[i][j] = min(table[i-1][j], table[i-1][j + curLen/2]); | |||
table[i][j] = std::min(table[i-1][j], table[i-1][j + curLen/2]); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
arpanmukherjee
Jun 2, 2020
Author
It is compiling without any errors/warnings. Should I still include #include<algorithm>
?
This comment has been minimized.
This comment has been minimized.
kvedala
Jun 2, 2020
Contributor
yes please. it may compile on some platforms but not on others. if you can confirm it compiles on linux, Mac, Win using GCC, Clang and MS Visual C++ compilers in its current format, then I am ok :)
This comment has been minimized.
This comment has been minimized.
kvedala
Jun 2, 2020
Contributor
you can check by creating a pull request here which will compile on all these platforms for you and confirm
This comment has been minimized.
This comment has been minimized.
I think the code fails for some of my test cases. What is the expected output for the array, being queried for
|
arpanmukherjee commentedJun 1, 2020
No description provided.