Sir....I tried the below code.. #include #include using namespace std; int main() { long long int n,count=0; int length,i; string sub_str; getline(cin,sub_str); cin>>n; length = sub_str.length(); if(length==1) { if(sub_str[i]=='a') { count=n; } else { count=0; } } // finding number of a's in substring else if(length>1) { for(i=0;i
great and clear explanation sir!!Thank you so much sir
Not only this sir,each and every video was awesome and easily understandable
Really clear explanation.
Definitely helped to understand this interesting HackerRank problem and the optimal solution.
Many thanks!!
crisp and clear ! thankss
No one can explain like you ☺
bro you're just amazing👌👌.we want this type of teaching.
Great explanations, thank you
10 out of 10 explanation 🌼️, tysm!
Thank you Sir, you taught it very well.
StringLeftLength=n%strLength;
Will be helpful?
I love you man!
Can you Please make it on Stock Span Problem
Reach out to me on my email in channel description with the problem link.
why is the time complexity O(1)? You have run the two loops in the code
I guess it's because the loop is run for size of input string and not on N. I'm this case it's 5 which can be dropped to 0(1)
Why can't we use this
stringLeftLength=n%strLength;
you can
Sir....I tried the below code..
#include
#include
using namespace std;
int main()
{
long long int n,count=0;
int length,i;
string sub_str;
getline(cin,sub_str);
cin>>n;
length = sub_str.length();
if(length==1)
{
if(sub_str[i]=='a')
{
count=n;
}
else
{
count=0;
}
}
// finding number of a's in substring
else if(length>1)
{
for(i=0;i
Try looking at the test cases I have in my code and debug your code with those cases.
Maybe you can catch the problem
how is this an easy question
It still wasn't clear
Which part did you face a problem at? I can try to elaborate
Shouldn't you `Math.floor(n / sLength)` the number of reps?