-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathchallenge.html
More file actions
36 lines (31 loc) · 1.03 KB
/
challenge.html
File metadata and controls
36 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<p>
Write a GPU program that counts the number of elements with the integer value k in an 2D array of 32-bit integers.
The program should count the number of elements with k in an 2D array.
You are given an input 2D array <code>input</code> of length <code>N x M</code> and integer <code>k</code>.
</p>
<h2>Implementation Requirements</h2>
<ul>
<li>Use only native features (external libraries are not permitted)</li>
<li>The <code>solve</code> function signature must remain unchanged</li>
<li>The final result must be stored in the <code>output</code> variable</li>
</ul>
<h2>Example 1:</h2>
<pre>
Input: input [[1, 2, 3],
[4, 5, 1]]
k = 1
Output: output = 2
</pre>
<h2>Example 2:</h2>
<pre>
Input: input [[5, 10],
[5, 2]]
k = 1
Output: output = 0
</pre>
<h2>Constraints</h2>
<ul>
<li>1 ≤ <code>N, M</code> ≤ 10,000</li>
<li>1 ≤ <code>input[i], k</code> ≤ 100</li>
<li>Performance is measured with <code>K</code> = 1, <code>M</code> = 10,000, <code>N</code> = 10,000</li>
</ul>