Last active
May 13, 2020 05:41
-
-
Save HarshCasper/5765deb8f5ec709e8b751db8af184d03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.codechef.com/LRNDSA01/problems/LAPIN | |
from math import ceil | |
n=int(input()) | |
while n: | |
string=input() | |
length=len(string) | |
str1,str2=list(string[:length//2]),list(string[ceil(length/2):]) | |
str1.sort() | |
str2.sort() | |
if str1==str2: | |
print("YES") | |
else: | |
print("NO") | |
n=n-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://codeforces.com/problemset/problem/1141/B | |
#include <bits/stdc++.h> | |
using namespace std; | |
int main(){ | |
int n; cin>>n; | |
vector<int> numbers; | |
int num; | |
for(int i=0;i<n;i++){ | |
cin>>num; | |
numbers.push_back(num); | |
} | |
for(int i=0;i<n;i++){ | |
numbers.push_back(numbers[i]); | |
} | |
int temp=0,result=0; | |
for(int i=0;i<n*2;i++){ | |
if(numbers[i]==1){ | |
temp++; | |
} | |
else{ | |
result=max(result,temp); | |
temp=0; | |
} | |
} | |
cout<<result; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.codechef.com/LRNDSA01/problems/FLOW007 | |
// https://www.geeksforgeeks.org/write-a-program-to-reverse-digits-of-a-number/ | |
#include <iostream> | |
using namespace std; | |
int main() { | |
int k; | |
cin>>k; | |
while(k--){ | |
long int n,rev=0,r; | |
cin>>n; | |
while(n>0){ | |
r=n%10; | |
rev=rev*10+r; | |
n=n/10; | |
} | |
cout<<rev<<endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment