Solution for StringStream in C++, one of the most popular HackerRank problem solving questions.
Learn how to use StringStream in C++ to extract formatted data from a string and store it into integer (int) or character (char) variables. Here, I am using the extraction operator with a StringStream class object in C++ to extract integers from a string and store them into a vector of integer elements. The extraction operation happens in a while loop. Knowing how to use StringStream in C++ is important for input/output operations in your programs, and also for competitive programming in C++.
HackerRank StringStream coding challenge:
Nguồn: https://sam-pointer.com/
Xem thêm bài viết khác: https://sam-pointer.com/cong-nghe/
Xem thêm Bài Viết:
- Chipset B550 – Kẻ thay thế X570 với mức giá MỀM hơn rất nhiều
- Which SSD Is Better – Samsung 860 PRO vs 850 PRO SSD
- Installing Samsung Evo 860 250Gb SSD in G41 Board | Unbox, Review & how to install OS in ssd + HDD
- Samsung 860 EVO Review and Installation
- Lounch Startup Repair Windows 7 #Start Windows Normally #Blue Screen Starting Windows
Sorry guys, somehow the first few seconds of this video got messed up, that's why the audio doesn't begin as expected.
how does peek method work here?
what does "while(ss)" means
I was getting confusion about this…..Thanks for the explanation…..Keep it on👍
why should we use (ss>>n)
in if clause? we could use it directly as
{
ss>>b;
v.push_back(b) ;
}
I don't understand why it gives wrong answer though.
is there anyway that we can store operator and make it functional
i have tried it by another approach but it is giving wrong answer
can u plz tell me the error?
"
vector<int> parseInts(string str)
{
stringstream s(str);
char ch;
int a;
while(s>>a||s>>ch)
{
g.push_back(a);
}
return g;
}
"
i am having time complexity error that "Your code did not execute within the time limits"
plzz help?
why u use if(ss >> n) { v. push_back(n) } statement plz explain bro..
Thanks, it was a good explanation.