DEV Community

Vishal Chovatiya
Vishal Chovatiya

Posted on

1 2

Need coding problems to practice STL algorithms

I am creating a list of coding problems which I can provide to my juniors to get habitual to using STL algorithm rather writing their own algorithm.

If you have any intuitive coding problem in mind where we can use the STL algorithm efficiently, you will be a great help. Combination of more than one algorithm is also good.

For example: Trim spaces from following string.

int main()
{
    string input_string = "1         2  3   4 5 55 5     ";

    // Your code

    return 0;
}
Enter fullscreen mode Exit fullscreen mode
  • Output
12345555
Enter fullscreen mode Exit fullscreen mode

Here we can apply std::unique, perfectly.

Top comments (2)

Collapse
 
delta456 profile image
Swastik Baranwal

You can check out this.

Collapse
 
visheshpatel profile image
Vishal Chovatiya

You didn't read my question properly, I guess. I am not looking for a solution. I am looking for a problem.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay