×

# 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".

4★avi224
218110
accept rate: 18%

 0 Where is the Author's solution code ? answered 29 Jul '18, 10:45 73●7 accept rate: 4%
 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,613
×2

question asked: 12 Apr '18, 23:34

question was seen: 151 times

last updated: 12 Apr '18, 23:35