×

CREP- Editorial

Contest

Author: avi224

Editorialist: avi224

CAKEWALK.

STL

PROBLEM:

Print the sum of all numbers in an array occurring exactly $K$ times. If there is no such number, print $-1$.

EXPLANATION:

This can be implemented by using a map or unordered map in C++. Just take the sum of numbers whose frequency is $K$, considering each number only once.

Solution

This question is marked "community wiki".

5★avi224
208110
accept rate: 25%

 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×1,344
×2