Skip to content

Commit

Permalink
problem on time and space complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandigupta authored Nov 29, 2023
1 parent a1a9675 commit beb986b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Time_and_Space_Complexity/scc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <iostream>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;

int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}

int ptr1=0;
int ptr2=k;
int a=0;
int count=0;
while(ptr2<n){
for(int i=ptr1;i<ptr2;i++){
a=a|arr[ptr1];
}
if(a%2!=0){
count++;
}
ptr1++;
ptr2++;
}

cout<<count<<endl;
}

}
Binary file added Time_and_Space_Complexity/scc.exe
Binary file not shown.

0 comments on commit beb986b

Please sign in to comment.