-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add Sliding Window XOR algorithm in C++ with test cases #3023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
f99f0d6
a285fc8
813cdca
a660364
643f101
07e65a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,125 @@ | ||||||||
/** | ||||||||
* @file | ||||||||
* @brief Implementation to [calculate XOR of sliding window of size k in an | ||||||||
* array of n integers] (https://cses.fi/problemset/task/3426) | ||||||||
* | ||||||||
* @details | ||||||||
* We are given an array of n integers. Our task is to calculate the bitwise XOR | ||||||||
* of each window of k elements, from left to right, and cumulatively XOR the | ||||||||
* results into a single value. | ||||||||
* | ||||||||
* Worst Case Time Complexity: O(n) | ||||||||
* Space Complexity: O(n) | ||||||||
* | ||||||||
* @author [Abhiraj Mandal](https://github.com/DataWorshipper) | ||||||||
*/ | ||||||||
|
||||||||
#include <cassert> /// for assert | ||||||||
#include <cstdint> | ||||||||
#include <iostream> /// for IO operations | ||||||||
#include <vector> | ||||||||
|
#include <vector> | |
#include <vector> /// for std::vector |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These variable names could be longer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These variables were in the problem statement ,i think it would be intuitive for the user who is following the problem statement
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could name these to be left and right, respectively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
Uh oh!
There was an error while loading. Please reload this page.