Count K-Subsequences of a String with Maximum Beauty Solution || Leetcode Bi-Weekly 112 Get link Facebook X Pinterest Email Other Apps - September 04, 2023 Count K-Subsequences of a String with Maximum Beauty Get link Facebook X Pinterest Email Other Apps
Distinct Binary Strings Solution || Codechef Starters - 27 Get link Facebook X Pinterest Email Other Apps - February 23, 2022 Distinct Binary Strings Solution Codechef Starters - 27Problem Code : BINSTRINGProblem Link : https://www.codechef.com/START27B/problems/BINSTRINGSolution :#include <bits/stdc++.h>#define ll long long int#define ull unsigned long long intusing namespace std;void solve(){ ll n; cin >> n; string s; cin >> s; ll ans = 1; char prev = s[0]; for (ll i = 1; i < n; i++) { if (s[i] == prev) { prev = s[i]; } else { prev = s[i]; ans++; } } cout << ans << "\n";}int main(){ ll t; cin >> t; while (t--) { solve(); }} Get link Facebook X Pinterest Email Other Apps Comments UnknownFebruary 23, 2022 at 8:03 AMbro more solutionsReplyDeleteRepliesReplyAdd commentLoad more... Post a Comment
Exact Marks Solution || Codechef March Long Challenge 2022 - I - March 11, 2022 Exact Marks Solution Read more
Substring of a Substring Solution || Codechef March Long Challenge 2022 - I - March 11, 2022 Substring of a Substring Solution Read more
Binary Base Basics Solution || Codechef February Long Challenge 2022 - I - February 04, 2022 Binary Base Basics Solution Read more
bro more solutions
ReplyDelete