mirror of
https://github.com/Manoj-HV30/dsa-competitive-programming.git
synced 2026-05-16 19:35:22 +00:00
add codeforces solutions folder
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
class Solution{
|
||||
public:
|
||||
char findKthBit(int n, int k){
|
||||
string seq = "0";
|
||||
for(int i = 1;i<n && seq.length() < k;++i){
|
||||
seq+='1';
|
||||
string temp = seq;
|
||||
for(int j=temp.length()-2;j>=0;--j){
|
||||
char invertedBit = (temp[j]=='1')? '0': '1';
|
||||
seq+=invertedBit;
|
||||
}
|
||||
}
|
||||
return seq[k-1];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user