Download results
Showing 0-0 of 0 results
Items per page:
10
25
50
100
#
Exercise Title
Features
Description
Platform
Keywords
1
Methods and Return Statements Review Quiz
Question
,
Battery
Methods and return statement for CS1 self-assessment questions.
OpenDSA
Method
,
Return Statement
2
Is it even
Free Coding Problem
,
coding problem
Coding Question
CodeWorkout
if
,
return
,
cci
,
coding problem
3
Return value
Python CodeVisualization for demonstrating Return value
JSVEE
functions
4
Return Bigger or None
Construct a function that returns the bigger value of the given arguments. If a and b are equal, it should...
jsParsons
functions
,
if-else statement
5
Returning a Boolean Statement
Free Coding Problem
,
code writing
Coding Question
CodeWorkout
CS1114
,
Jeroo
,
Accessor
,
Java
,
getter
,
code writing
6
Assign Return
C++ BehaviorExample for demonstrating Assign Return
AnnEx
7
Multiple Return
C++ BehaviorExample for demonstrating Multiple Return
AnnEx
8
Simple Text Parameter Return
Free Coding Problem
,
coding problem
Coding Question
CodeWorkout
print
,
coding problem
9
Linear Search Return Index
Free Coding Problem
Coding Question
CodeWorkout
linear search
,
search
,
array
,
int
,
cci
10
Linear Search (Strings) Return Index
Free Coding Problem
Coding Question
CodeWorkout
linear search
,
search
,
array
,
String
,
cci
11
Linear Search (Strings) Return Object
Free Coding Problem
Coding Question
CodeWorkout
linear search
,
search
,
array
,
String
,
cci
12
Construct a function that returns a list of remainders from the input.
Construct a function which calculates the remainder of each element of the first list and the element with the same...
jsParsons
13
Construct a function that returns a list of remainders from the input.
Construct a program which calculates the remainder of each element of the first list and the element with the same...
jsParsons
14
Accessors and Returns
Free Coding Problem
,
code writing
Coding Question
CodeWorkout
CS1114
,
Jeroo
,
Accessor
,
Java
,
getter
,
code writing
15
Given a list a, return the longest n so that the first n elements equal the last n elements.
Code Completion
Given a list a, return the longest n so that the first n elements equal the last n elements.
CodeCheck
Lists - Simple Exercises
,
Double Loops
16
Given an integer n, return a list of length n containing 1 -1 1 -1 .
Code Completion
Given an integer n, return a list of length n containing 1 -1 1 -1 ...
CodeCheck
Lists - Simple Exercises
,
Filling
17
Given an integer n, return a list containing 1 2 2 3 3 3 4 4 4 4 .
Code Completion
Given an integer n, return a list containing 1 2 2 3 3 3 4 4 4 4 ... and...
CodeCheck
Lists - Simple Exercises
,
Filling
18
Given two numbers, return true if they both have the same sign.
Code Completion
Given two numbers, return true if they both have the same sign.
CodeCheck
Branches
,
Branches with Functions
19
Given two numbers, return their distance if it less than 10, or 10 otherwise.
Code Completion
Given two numbers, return their distance if it less than 10, or 10 otherwise.
CodeCheck
Branches
,
Branches with Functions
20
Given three numbers, return true if they are evenly spaced; that is, sorted in ascending or descending order, with the same distance between them.
Code Completion
Given three numbers, return true if they are evenly spaced; that is, sorted in ascending or descending order, with the...
CodeCheck
Branches
,
Branches with Functions
21
Given a string s, return the first vowel that is doubled in the string.
Code Completion
Given a string s, return the first vowel that is doubled in the string.
CodeCheck
Strings
,
Other String Operations
22
Given a string s, return the string with adjacent duplicates removed.
Code Completion
Given a string s, return the string with adjacent duplicates removed. For example, Mississippi yields Misisipi.
CodeCheck
Strings
,
Other String Operations
23
Given a string, return a string composed first of all characters at even positions and then of all characters at odd positions.
Code Completion
Given a string, return a string composed first of all characters at even positions and then of all characters at...
CodeCheck
Strings
,
Other String Operations
24
Given a string s, return the longest prefix that is repeated somewhere else in the string.
Code Completion
Given a string s, return the longest prefix that is repeated somewhere else in the string.
CodeCheck
Strings
,
Finding Substrings
25
Given a string, return the string with the first and last characters swapped.
Code Completion
Given a string, return the string with the first and last characters swapped.
CodeCheck
Strings
,
No Loops
26
Given a string, return the string with the middle two characters removed if it has even length, and the middle character removed if it has odd length.
Code Completion
Given a string, return the string with the middle two characters removed if it has even length, and the middle...
CodeCheck
Strings
,
No Loops
27
Given a string, return the string with the middle two characters swapped if it has even length, and the middle three characters swapped if it has odd length.
Code Completion
Given a string, return the string with the middle two characters swapped if it has even length, and the middle...
CodeCheck
Strings
,
No Loops
28
Given a string, return the string with the first and second half swapped.
Code Completion
Given a string, return the string with the first and second half swapped. If the string has odd length, leave...
CodeCheck
Strings
,
No Loops
29
Given a string, return the string with the first half and the second half doubled.
Code Completion
Given a string, return the string with the first half and the second half doubled. For example, Java becomes JaJavava...
CodeCheck
Strings
,
No Loops
30
Given a string, return the string with the first and last characters swapped.
Code Completion
Given a string, return the string with the first and last characters swapped.
CodeCheck
Strings
,
No Loops
31
Given a string, return the string with the middle two characters swapped if it has even length, and the middle three characters swapped if it has odd length.
Code Completion
Given a string, return the string with the middle two characters swapped if it has even length, and the middle...
CodeCheck
Strings
,
No Loops
32
Given a string, return the string with the first and second half swapped.
Code Completion
Given a string, return the string with the first and second half swapped. If the string has odd length, leave...
CodeCheck
Strings
,
No Loops
33
Given a string, return the string with the first half and the second half doubled.
Code Completion
Given a string, return the string with the first half and the second half doubled. For example, Java becomes JaJavava...
CodeCheck
Strings
,
No Loops
34
Given a string, return the string with the middle two characters removed if it has even length, and the middle character removed if it has odd length.
Code Completion
Given a string, return the string with the middle two characters removed if it has even length, and the middle...
CodeCheck
Strings
,
No Loops
35
Given a string s, return the string with adjacent duplicates removed.
Code Completion
Given a string s, return the string with adjacent duplicates removed. For example, Mississippi yields Misisipi.
CodeCheck
Strings
,
Other String Operations
36
Given a string, return a string composed first of all characters at even positions and then of all characters at odd positions.
Code Completion
Given a string, return a string composed first of all characters at even positions and then of all characters at...
CodeCheck
Strings
,
Other String Operations
37
Given a string s, return the first vowel that is doubled in the string.
Code Completion
Given a string s, return the first vowel that is doubled in the string.
CodeCheck
Strings
,
Other String Operations
38
Given two numbers, return true if they both have the same sign.
Code Completion
Given two numbers, return true if they both have the same sign.
CodeCheck
Branches
,
Branches with Functions
39
Given two numbers, return their distance if it less than 10, or 10 otherwise.
Code Completion
Given two numbers, return their distance if it less than 10, or 10 otherwise.
CodeCheck
Branches
,
Branches with Functions
40
Given three numbers, return true if they are evenly spaced; that is, sorted in ascending or descending order, with the same distance between them.
Code Completion
Given three numbers, return true if they are evenly spaced; that is, sorted in ascending or descending order, with the...
CodeCheck
Branches
,
Branches with Functions
41
Given an array a, return the longest n so that the first n elements equal the last n elements.
Code Completion
Given an array a, return the longest n so that the first n elements equal the last n elements.
CodeCheck
Arrays - Simple Exercises
,
Double Loops
42
Given a string s, return the longest prefix that is repeated somewhere else in the string.
Code Completion
Given a string s, return the longest prefix that is repeated somewhere else in the string.
CodeCheck
Strings
,
Finding Substrings
43
Given a two-dimensional array of integers, return the average of the four corner elements.
Code Completion
Given a two-dimensional array of integers, return the average of the four corner elements.
CodeCheck
Two-Dimensional Arrays
,
No Loops
44
Given a two-dimensional array of integers, return the middle element if both the row and column lenghts are odd, or the average of the two or four middle elements of one or both is even.
Code Completion
Given a two-dimensional array of integers, return the middle element if both the row and column lenghts are odd, or...
CodeCheck
Two-Dimensional Arrays
,
No Loops
45
Given a list of integers of length ≥ 4, return the average of the first two and last two elements.
Code Completion
Given a list of integers of length ≥ 4, return the average of the first two and last two elements.
CodeCheck
Lists - Simple Exercises
,
No loops
46
Given a list of integers of length ≥ 3, return the average of the first, last, and middle element (or the two middle elements if the length is even).
Code Completion
Given a list of integers of length ≥ 3, return the average of the first, last, and middle element (or...
CodeCheck
Lists - Simple Exercises
,
No loops
47
Given a two-dimensional array of integers, return the number of distinct elements.
Code Completion
Given a two-dimensional array of integers, return the number of distinct elements.
CodeCheck
Two-Dimensional Arrays
,
Complex Loops
48
Given a two-dimensional array of integers, return the index of the first row that is entirely filled with zeroes.
Code Completion
Given a two-dimensional array of integers, return the index of the first row that is entirely filled with zeroes.
CodeCheck
Two-Dimensional Arrays
,
Complex Loops
49
Given a two-dimensional array of integers, return the top left corner of the first subarray of the form <pre>0 0 0 0</pre>
Code Completion
Given a two-dimensional array of integers, return the top left corner of the first subarray of the form
0 0...
CodeCheck
Two-Dimensional Arrays
,
Complex Loops
50
Given a two-dimensional array of integers, return the position of the largest square subarray filled with zeroes, as a list of length 2.
Code Completion
Given a two-dimensional array of integers, return the position of the largest square subarray filled with zeroes, as a list...
CodeCheck
Two-Dimensional Arrays
,
Complex Loops
51
Given a list of integers, return the most frequent element.
Code Completion
Given a list of integers, return the most frequent element. If there is more than one element with maximum frequency,...
CodeCheck
Lists - Simple Exercises
,
Counting Elements
52
Given a list of integers, return a list of all elements that occur with maximum frequency.
Code Completion
Given a list of integers, return a list of all elements that occur with maximum frequency.
CodeCheck
Lists - Simple Exercises
,
Counting Elements
53
Given a list of integers, return the position of the first element that occurs more than once, or -1 if all elements occur exactly once.
Code Completion
Given a list of integers, return the position of the first element that occurs more than once, or -1 if...
CodeCheck
Lists - Simple Exercises
,
Counting Elements
54
Given a list of integers, return a list of all elements that occur exactly once.
Code Completion
Given a list of integers, return a list of all elements that occur exactly once.
CodeCheck
Lists - Simple Exercises
,
Counting Elements
55
Given two lists a and b, return a list that contains all elements occurring in a but not in b.
Code Completion
Given two lists a and b, return a list that contains all elements occurring in a but not in b.
CodeCheck
Lists - Simple Exercises
,
Double Loops
56
Given a list of integers, return the largest sum of consecutive elements.
Code Completion
Given a list of integers, return the largest sum of consecutive elements.
CodeCheck
Lists - Simple Exercises
,
Double Loops
57
Given a list of integers, return the largest sequence whose reverse also occurs somewhere in the list.
Code Completion
Given a list of integers, return the largest sequence whose reverse also occurs somewhere in the list.
CodeCheck
Lists - Simple Exercises
,
Double Loops
58
Given a list a of integers, return a list of all elements of a that occur exactly once.
Code Completion
Given a list a of integers, return a list of all elements of a that occur exactly once.
CodeCheck
Lists - Simple Exercises
,
Double Loops
59
Given a list of integers, return a list of lists of length 2, containing each unique element together with its frequency.
Code Completion
Given a list of integers, return a list of lists of length 2, containing each unique element together with its...
CodeCheck
Lists - Simple Exercises
,
Double Loops
60
Given a list of integers, return the position of the longest subsequence of consecutive integers a, a + 1, a + 2, .
Code Completion
Given a list of integers, return the position of the longest subsequence of consecutive integers a, a + 1, a...
CodeCheck
Lists - Simple Exercises
,
Double Loops
61
Given integers n and k, return a list of length n containing 0 1 2 .
Code Completion
Given integers n and k, return a list of length n containing 0 1 2 ... k-1 0 1 2...
CodeCheck
Lists - Simple Exercises
,
Filling
62
Given integers a and b, return a list containing a, a + 1, a + 2, .
Code Completion
Given integers a and b, return a list containing a, a + 1, a + 2, ..., b.
CodeCheck
Lists - Simple Exercises
,
Filling
63
Given integers a and b, return a list containing all even numbers that are at least a and at most b.
Code Completion
Given integers a and b, return a list containing all even numbers that are at least a and at most...
CodeCheck
Lists - Simple Exercises
,
Filling
64
Given a list of integers and a value, return the position of the last occurrence of the value in the list, or -1 if the value does not exist.
Code Completion
Given a list of integers and a value, return the position of the last occurrence of the value in the...
CodeCheck
Lists - Simple Exercises
,
Finding Elements
65
Given a list of integers and a value, return the difference between the last and first position of the value in the list, or -1 if the value does not exist.
Code Completion
Given a list of integers and a value, return the difference between the last and first position of the value...
CodeCheck
Lists - Simple Exercises
,
Finding Elements
66
Given a list of integers and a value, return a list of all positions of the value in the list.
Code Completion
Given a list of integers and a value, return a list of all positions of the value in the list.
CodeCheck
Lists - Simple Exercises
,
Finding Elements
67
Given a list of integers and a value, return the position of the element that is closest to the value.
Code Completion
Given a list of integers and a value, return the position of the element that is closest to the value....
CodeCheck
Lists - Simple Exercises
,
Finding Elements
68
Given a two-dimensional array of integers, return the largest element in the array.
Code Completion
Given a two-dimensional array of integers, return the largest element in the array.
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
69
Given a two-dimensional array of integers, return the position of the smallest element in the array as a list of length 2.
Code Completion
Given a two-dimensional array of integers, return the position of the smallest element in the array as a list of...
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
70
Given an r x c array of integers, return an (r + 2) x (c + 2) array whose borders are zero and whose interior is the original array.
Code Completion
Given an r x c array of integers, return an (r + 2) x (c + 2) array whose borders...
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
71
Given a two-dimensional array of integers, return a list of the largest element in each row.
Code Completion
Given a two-dimensional array of integers, return a list of the largest element in each row.
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
72
Given a two-dimensional array of integers, return a list of the number of negative elements in each row.
Code Completion
Given a two-dimensional array of integers, return a list of the number of negative elements in each row.
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
73
Given a two-dimensional array of integers, return the sum of all elements along the north and south border.
Code Completion
Given a two-dimensional array of integers, return the sum of all elements along the north and south border.
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
74
Given a two-dimensional array of integers, return the sum of all elements along all borders but not the corners.
Code Completion
Given a two-dimensional array of integers, return the sum of all elements along all borders but not the corners.
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
75
Given a two-dimensional array of integers, return the sum of all elements along all borders including the corners.
Code Completion
Given a two-dimensional array of integers, return the sum of all elements along all borders including the corners.
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
76
Given a two-dimensional square array of integers, return the sum of the elements along both diagonals.
Code Completion
Given a two-dimensional square array of integers, return the sum of the elements along both diagonals. Make sure not to...
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
77
Given a list of integers, return the position of the first occurrence of the largest element.
Code Completion
Given a list of integers, return the position of the first occurrence of the largest element.
CodeCheck
Lists - Simple Exercises
,
Maximum and Minimum
78
Given a list of integers, return the position of the last occurrence of the largest element.
Code Completion
Given a list of integers, return the position of the last occurrence of the largest element.
CodeCheck
Lists - Simple Exercises
,
Maximum and Minimum
79
Given a list of integers, return the difference of the positions of the first and the last occurrence of the largest element.
Code Completion
Given a list of integers, return the difference of the positions of the first and the last occurrence of the...
CodeCheck
Lists - Simple Exercises
,
Maximum and Minimum
80
Given a list of integers, return the difference between the maximum and minimum.
Code Completion
Given a list of integers, return the difference between the maximum and minimum.
CodeCheck
Lists - Simple Exercises
,
Maximum and Minimum
81
Given a list of integers, return the second-largest element.
Code Completion
Given a list of integers, return the second-largest element.
CodeCheck
Lists - Simple Exercises
,
Maximum and Minimum
82
Given a string s and an integer n, return a string in which each of the characters in s is repeated n times.
Code Completion
Given a string s and an integer n, return a string in which each of the characters in s is...
CodeCheck
Strings
,
Other String Operations
83
Given a string s and a string t, return a string in which all the characters of s that occur in t have been replaced by a _ character.
Code Completion
Given a string s and a string t, return a string in which all the characters of s that occur...
CodeCheck
Strings
,
Other String Operations
84
Given a two-dimensional array a, return a list whose [i][j] element is the average of the neighbors of a[i][j] in the N, E, S, W direction.
Code Completion
Given a two-dimensional array a, return a list whose [i][j] element is the average of the neighbors of a[i][j] in...
CodeCheck
Two-Dimensional Arrays
,
Producing 2D Arrays
85
Given two strings s and t, return the first position where their characters differ, or -1 if they are identical.
Code Completion
Given two strings s and t, return the first position where their characters differ, or -1 if they are identical.
CodeCheck
Strings
,
Comparing Strings
86
Given two strings s and t, return the first position where their characters are the same, or -1 if there is no such position.
Code Completion
Given two strings s and t, return the first position where their characters are the same, or -1 if there...
CodeCheck
Strings
,
Comparing Strings
87
Given strings s and t, return a list of all positions in which t occurs in s.
Code Completion
Given strings s and t, return a list of all positions in which t occurs in s.
CodeCheck
Strings
,
Finding Substrings
88
Given strings s and t, return a string in which all occurrences of t are removed from s.
Code Completion
Given strings s and t, return a string in which all occurrences of t are removed from s.
CodeCheck
Strings
,
Finding Substrings
89
Given strings s and t, return a string in which all characters in t are removed from s.
Code Completion
Given strings s and t, return a string in which all characters in t are removed from s.
CodeCheck
Strings
,
Finding Substrings
90
Given a string, find all integers inside and return a string that separates them by commas.
Code Completion
Given a string, find all integers inside and return a string that separates them by commas.
CodeCheck
Strings
,
Numbers in Strings
91
Given a list of integers, return the sum of all positive elements.
Code Completion
Given a list of integers, return the sum of all positive elements.
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
92
Given a list of floating-point numbers, return a list of the averages of consecutive element pairs of the original list.
Code Completion
Given a list of floating-point numbers, return a list of the averages of consecutive element pairs of the original list.
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
93
Given a list of integers, return the average of all elements that are not the maximum or minimum.
Code Completion
Given a list of integers, return the average of all elements that are not the maximum or minimum.
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
94
Given a list of integers, return the sum of all odd elements.
Code Completion
Given a list of integers, return the sum of all odd elements.
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
95
Given a list of integers, return the average of all positive elements.
Code Completion
Given a list of integers, return the average of all positive elements.
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
96
Given a list of integers, return the product of all non-zero elements.
Code Completion
Given a list of integers, return the product of all non-zero elements.
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
97
Given a list of integers, return a list of length 2 containing the first and last element, in sorted order.
Code Completion
Given a list of integers, return a list of length 2 containing the first and last element, in sorted order.
CodeCheck
Lists - Simple Exercises
,
Two Answers
98
Given a list of integers, return a list of length 2 containing the minimum and the maximum.
Code Completion
Given a list of integers, return a list of length 2 containing the minimum and the maximum.
CodeCheck
Lists - Simple Exercises
,
Two Answers
99
Given a list of integers, return a list of length 2, with the number of positive and the number of negative elements in the list.
Code Completion
Given a list of integers, return a list of length 2, with the number of positive and the number of...
CodeCheck
Lists - Simple Exercises
,
Two Answers
100
Given a list of integers, return a list of length 2, each being a list.
Code Completion
Given a list of integers, return a list of length 2, each being a list. The first one holds the...
CodeCheck
Lists - Simple Exercises
,
Two Answers
101
Given a list of integers, return a list of length 2, each being a list.
Code Completion
Given a list of integers, return a list of length 2, each being a list. The first one holds the...
CodeCheck
Lists - Simple Exercises
,
Two Answers
102
Given a string, find all integers inside and return a string that separates them by commas.
Code Completion
Given a string, find all integers inside and return a string that separates them by commas.
CodeCheck
Strings
,
Numbers in Strings
103
Given a two-dimensional array of integers, return an array of the number of negative elements in each column.
Code Completion
Given a two-dimensional array of integers, return an array of the number of negative elements in each column.
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
104
Given a two-dimensional array of integers, return the position of the smallest element in the array as an array of length 2.
Code Completion
Given a two-dimensional array of integers, return the position of the smallest element in the array as an array of...
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
105
Given a two-dimensional array of integers, return the largest element in the array.
Code Completion
Given a two-dimensional array of integers, return the largest element in the array.
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
106
Given a two-dimensional array of integers, return an array of the largest element in each row.
Code Completion
Given a two-dimensional array of integers, return an array of the largest element in each row.
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
107
Given an r x c array of integers, return an (r + 2) x (c + 2) array whose borders are zero and whose interior is the original array.
Code Completion
Given an r x c array of integers, return an (r + 2) x (c + 2) array whose borders...
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
108
Given an array of integers, return the position of the first occurrence of the largest element.
Code Completion
Given an array of integers, return the position of the first occurrence of the largest element.
CodeCheck
Arrays - Simple Exercises
,
Maximum and Minimum
109
Given an array of integers, return the difference of the positions of the first and the last occurrence of the largest element.
Code Completion
Given an array of integers, return the difference of the positions of the first and the last occurrence of the...
CodeCheck
Arrays - Simple Exercises
,
Maximum and Minimum
110
Given an array of integers, return the difference between the maximum and minimum.
Code Completion
Given an array of integers, return the difference between the maximum and minimum.
CodeCheck
Arrays - Simple Exercises
,
Maximum and Minimum
111
Given an array of integers, return the second-largest element.
Code Completion
Given an array of integers, return the second-largest element.
CodeCheck
Arrays - Simple Exercises
,
Maximum and Minimum
112
Given an array of integers, return the position of the last occurrence of the largest element.
Code Completion
Given an array of integers, return the position of the last occurrence of the largest element.
CodeCheck
Arrays - Simple Exercises
,
Maximum and Minimum
113
Given a two-dimensional array of integers, return the number of distinct elements.
Code Completion
Given a two-dimensional array of integers, return the number of distinct elements.
CodeCheck
Two-Dimensional Arrays
,
Complex Loops
114
Given a two-dimensional array of integers, return the index of the first row that is entirely filled with zeroes.
Code Completion
Given a two-dimensional array of integers, return the index of the first row that is entirely filled with zeroes.
CodeCheck
Two-Dimensional Arrays
,
Complex Loops
115
Given a two-dimensional array of integers, return the index of the first row that is entirely filled with zeroes.
Code Completion
Given a two-dimensional array of integers, return the index of the first row that is entirely filled with zeroes. <
CodeCheck
Two-Dimensional Arrays
,
Complex Loops
116
Given a two-dimensional array of integers, return the position of the largest square subarray filled with zeroes, as an array of length 2.
Code Completion
Given a two-dimensional array of integers, return the position of the largest square subarray filled with zeroes, as an array...
CodeCheck
Two-Dimensional Arrays
,
Complex Loops
117
Given an array of integers of length ≥ 4, return the average of the first two and last two elements.
Code Completion
Given an array of integers of length ≥ 4, return the average of the first two and last two elements.
CodeCheck
Arrays - Simple Exercises
,
No loops
118
Given an array of integers of length ≥ 3, return the average of the first, last, and middle element (or the two middle elements if the length is even).
Code Completion
Given an array of integers of length ≥ 3, return the average of the first, last, and middle element (or...
CodeCheck
Arrays - Simple Exercises
,
No loops
119
Given an array of integers, return the sum of all positive elements.
Code Completion
Given an array of integers, return the sum of all positive elements.
CodeCheck
Arrays - Simple Exercises
,
Sums
,
Averages
,
Products
120
Given an array of floating-point numbers, return an array of the averages of consecutive element pairs of the original array.
Code Completion
Given an array of floating-point numbers, return an array of the averages of consecutive element pairs of the original array.
CodeCheck
Arrays - Simple Exercises
,
Sums
,
Averages
,
Products
121
Given an array of integers, return the average of all positive elements.
Code Completion
Given an array of integers, return the average of all positive elements.
CodeCheck
Arrays - Simple Exercises
,
Sums
,
Averages
,
Products
122
Given an array of integers, return the average of all elements that are not the maximum or minimum.
Code Completion
Given an array of integers, return the average of all elements that are not the maximum or minimum.
CodeCheck
Arrays - Simple Exercises
,
Sums
,
Averages
,
Products
123
Given an array of integers, return the product of all non-zero elements.
Code Completion
Given an array of integers, return the product of all non-zero elements.
CodeCheck
Arrays - Simple Exercises
,
Sums
,
Averages
,
Products
124
Given an array of integers, return the sum of all odd elements.
Code Completion
Given an array of integers, return the sum of all odd elements.
CodeCheck
Arrays - Simple Exercises
,
Sums
,
Averages
,
Products
125
Given a two-dimensional array a, return an array whose [i][j] element is the average of the neighbors of a[i][j] in the N, E, S, W direction.
Code Completion
Given a two-dimensional array a, return an array whose [i][j] element is the average of the neighbors of a[i][j] in...
CodeCheck
Two-Dimensional Arrays
,
Producing 2D Arrays
126
Given a string s and a character c, return a string with the characters surrounding any occurrence of c reversed.
Code Completion
Given a string s and a character c, return a string with the characters surrounding any occurrence of c reversed....
CodeCheck
Strings
,
Other String Operations
127
Given a string s and an integer n, return a string in which each of the characters in s is repeated n times.
Code Completion
Given a string s and an integer n, return a string in which each of the characters in s is...
CodeCheck
Strings
,
Other String Operations
128
Given a string s and a string t, return a string in which all the characters of s that occur in t have been replaced by a _ sign.
Code Completion
Given a string s and a string t, return a string in which all the characters of s that occur...
CodeCheck
Strings
,
Other String Operations
129
Given a string s and a character c, return a string with the characters surrounding the first of c reversed.
Code Completion
Given a string s and a character c, return a string with the characters surrounding the first of c reversed....
CodeCheck
Strings
,
Other String Operations
130
Given an array of integers, return an array of length 2 containing the first and last element, in sorted order.
Code Completion
Given an array of integers, return an array of length 2 containing the first and last element, in sorted order.
CodeCheck
Arrays - Simple Exercises
,
Two Answers
131
Given an array of integers, return an array of length 2, with the number of positive and the number of negative elements in the array.
Code Completion
Given an array of integers, return an array of length 2, with the number of positive and the number of...
CodeCheck
Arrays - Simple Exercises
,
Two Answers
132
Given an array of integers, return an array of length 2, each being an array.
Code Completion
Given an array of integers, return an array of length 2, each being an array. The first one holds the...
CodeCheck
Arrays - Simple Exercises
,
Two Answers
133
Given an array of integers, return an array of length 2, each being an array.
Code Completion
Given an array of integers, return an array of length 2, each being an array. The first one holds the...
CodeCheck
Arrays - Simple Exercises
,
Two Answers
134
Given an array of integers, return an array of length 2 containing the minimum and the maximum.
Code Completion
Given an array of integers, return an array of length 2 containing the minimum and the maximum.
CodeCheck
Arrays - Simple Exercises
,
Two Answers
135
Given a two-dimensional square array of integers, return the sum of the elements along both diagonals.
Code Completion
Given a two-dimensional square array of integers, return the sum of the elements along both diagonals. Make sure not to...
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
136
Given a two-dimensional array of integers, return the sum of all elements along the north and south border.
Code Completion
Given a two-dimensional array of integers, return the sum of all elements along the north and south border.
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
137
Given a two-dimensional array of integers, return the sum of all elements along all borders including the corners.
Code Completion
Given a two-dimensional array of integers, return the sum of all elements along all borders including the corners.
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
138
Given a two-dimensional array of integers, return the sum of all elements along all borders but not the corners.
Code Completion
Given a two-dimensional array of integers, return the sum of all elements along all borders but not the corners.
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
139
Given an array of integers and a value, return the position of the last occurrence of the value in the array, or -1 if the value does not exist.
Code Completion
Given an array of integers and a value, return the position of the last occurrence of the value in the...
CodeCheck
Arrays - Simple Exercises
,
Finding Elements
140
Given an array of integers and a value, return the position of the element that is closest to the value.
Code Completion
Given an array of integers and a value, return the position of the element that is closest to the value....
CodeCheck
Arrays - Simple Exercises
,
Finding Elements
141
Given an array of integers and a value, return the difference between the last and first position of the value in the array, or -1 if the value does not exist.
Code Completion
Given an array of integers and a value, return the difference between the last and first position of the value...
CodeCheck
Arrays - Simple Exercises
,
Finding Elements
142
Given an array of integers, return the largest sum of consecutive elements.
Code Completion
Given an array of integers, return the largest sum of consecutive elements.
CodeCheck
Arrays - Simple Exercises
,
Double Loops
143
Given an array of integers, return the largest sequence whose reverse also occurs somewhere in the array.
Code Completion
Given an array of integers, return the largest sequence whose reverse also occurs somewhere in the array.
CodeCheck
Arrays - Simple Exercises
,
Double Loops
144
Given an array a of integers, return an array of all elements of a that occur exactly once.
Code Completion
Given an array a of integers, return an array of all elements of a that occur exactly once.
CodeCheck
Arrays - Simple Exercises
,
Double Loops
145
Given two arrays a and b, return an array that contains all elements occurring in a but not in b.
Code Completion
Given two arrays a and b, return an array that contains all elements occurring in a but not in b.
CodeCheck
Arrays - Simple Exercises
,
Double Loops
146
Given an array of integers, return the position of the longest subsequence of consecutive integers a, a + 1, a + 2, .
Code Completion
Given an array of integers, return the position of the longest subsequence of consecutive integers a, a + 1, a...
CodeCheck
Arrays - Simple Exercises
,
Double Loops
147
Given an array of integers, return an array of arrays of length 2, containing each unique element together with its frequency.
Code Completion
Given an array of integers, return an array of arrays of length 2, containing each unique element together with its...
CodeCheck
Arrays - Simple Exercises
,
Double Loops
148
Given strings s and t, return a list of all positions in which t occurs in s.
Code Completion
Given strings s and t, return a list of all positions in which t occurs in s.
CodeCheck
Strings
,
Finding Substrings
149
Given strings s and t, return a string in which all characters in t are removed from s.
Code Completion
Given strings s and t, return a string in which all characters in t are removed from s.
CodeCheck
Strings
,
Finding Substrings
150
Given strings s and t, return a string in which all occurrences of t are removed from s.
Code Completion
Given strings s and t, return a string in which all occurrences of t are removed from s.
CodeCheck
Strings
,
Finding Substrings
151
Given a two-dimensional array of integers, return the average of the four corner elements.
Code Completion
Given a two-dimensional array of integers, return the average of the four corner elements.
CodeCheck
Two-Dimensional Arrays
,
No Loops
152
Given a two-dimensional array of integers, return the middle element if both the row and column lenghts are odd, or the average of the two or four middle elements of one or both is even.
Code Completion
Given a two-dimensional array of integers, return the middle element if both the row and column lenghts are odd, or...
CodeCheck
Two-Dimensional Arrays
,
No Loops
153
Given two strings s and t, return the first position where their characters differ, or -1 if they are identical.
Code Completion
Given two strings s and t, return the first position where their characters differ, or -1 if they are identical.
CodeCheck
Strings
,
Comparing Strings
154
Given two strings s and t, return the first position where their characters are the same, or -1 if there is no such position.
Code Completion
Given two strings s and t, return the first position where their characters are the same, or -1 if there...
CodeCheck
Strings
,
Comparing Strings
155
Given an array of integers, return the most frequent element.
Code Completion
Given an array of integers, return the most frequent element. If there is more than one element with maximum frequency,...
CodeCheck
Arrays - Simple Exercises
,
Counting Elements
156
Given an array of integers, return an array of all elements that occur with maximum frequency.
Code Completion
Given an array of integers, return an array of all elements that occur with maximum frequency.
CodeCheck
Arrays - Simple Exercises
,
Counting Elements
157
Given an array of integers, return the position of the first element that occurs more than once, or -1 if all elements occur exactly once.
Code Completion
Given an array of integers, return the position of the first element that occurs more than once, or -1 if...
CodeCheck
Arrays - Simple Exercises
,
Counting Elements
158
Given an array of integers, return an array of all elements that occur exactly once.
Code Completion
Given an array of integers, return an array of all elements that occur exactly once.
CodeCheck
Arrays - Simple Exercises
,
Counting Elements
159
Given two lists of integers of the same length, return the first position where their elements are the same.
Code Completion
Given two lists of integers of the same length, return the first position where their elements are the same.
CodeCheck
Lists - Simple Exercises
,
Finding Elements
160
Given two lists of integers of the same length, return the first position where their elements differ.
Code Completion
Given two lists of integers of the same length, return the first position where their elements differ.
CodeCheck
Lists - Simple Exercises
,
Finding Elements
161
Given a two-dimensional array of integers and a value x, return the position of the first match as a list of length 2.
Code Completion
Given a two-dimensional array of integers and a value x, return the position of the first match as a list...
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
162
Given a two-dimensional array of integers and a value x, return the positions of all matching elements, as a list of arrays of length 2.
Code Completion
Given a two-dimensional array of integers and a value x, return the positions of all matching elements, as a list...
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
163
Given a two-dimensional array of integers and a row index, return the largest element in that row.
Code Completion
Given a two-dimensional array of integers and a row index, return the largest element in that row.
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
164
Given a two-dimensional array of integers and a column index, return the smallest element in that column.
Code Completion
Given a two-dimensional array of integers and a column index, return the smallest element in that column.
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
165
Given a string s and a character c (as string of length 1), return a string with the characters surrounding the first occurrence of c reversed.
Code Completion
Given a string s and a character c (as string of length 1), return a string with the characters surrounding...
CodeCheck
Strings
,
Other String Operations
166
Given a string s and a character c (as string of length 1), return a string with the characters surrounding any occurrence of c reversed.
Code Completion
Given a string s and a character c (as string of length 1), return a string with the characters surrounding...
CodeCheck
Strings
,
Other String Operations
167
Given two two-dimensional arrays of integers with the same number of rows and columns, return the first position where they do not match, as a list of length 2.
Code Completion
Given two two-dimensional arrays of integers with the same number of rows and columns, return the first position where they...
CodeCheck
Two-Dimensional Arrays
,
Producing 2D Arrays
168
Given two two-dimensional arrays with the same number of rows, return a list that places them side by side.
Code Completion
Given two two-dimensional arrays with the same number of rows, return a list that places them side by side.
CodeCheck
Two-Dimensional Arrays
,
Producing 2D Arrays
169
Given a string, find the first integer inside and return its value as an integer.
Code Completion
Given a string, find the first integer inside and return its value as an integer. Return 0 if there is...
CodeCheck
Strings
,
Numbers in Strings
170
Given a string in which words are separated by spaces, return the longest word.
Code Completion
Given a string in which words are separated by spaces, return the longest word.
CodeCheck
Strings
,
Words
171
Given a string in which words are separated by spaces, return the first word that is duplicated (such as an accidental “this this”.
Code Completion
Given a string in which words are separated by spaces, return the first word that is duplicated (such as an...
CodeCheck
Strings
,
Words
172
Given a string in which words are separated by spaces, return the first word that is repeated somewhere in the string.
Code Completion
Given a string in which words are separated by spaces, return the first word that is repeated somewhere in the...
CodeCheck
Strings
,
Words
173
Given a list of integers and an integer n, return a list of the averages of n consecutive elements of the original list.
Code Completion
Given a list of integers and an integer n, return a list of the averages of n consecutive elements of...
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
174
Given a list of integers and two values a and b, return the sum of all elements that are at least a and at most b.
Code Completion
Given a list of integers and two values a and b, return the sum of all elements that are at...
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
175
Given a list of strings and a string s, return the average length of all strings containing s.
Code Completion
Given a list of strings and a string s, return the average length of all strings containing s.
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
176
Given a string, find the first integer inside and return its value as an integer.
Code Completion
Given a string, find the first integer inside and return its value as an integer. Return 0 if there is...
CodeCheck
Strings
,
Numbers in Strings
177
Given a two-dimensional array of integers and a value x, return the position of the first match as an array of length 2.
Code Completion
Given a two-dimensional array of integers and a value x, return the position of the first match as an array...
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
178
Given a two-dimensional array of integers and a value x, return the positions of all matching elements, as an array of arrays of length 2.
Code Completion
Given a two-dimensional array of integers and a value x, return the positions of all matching elements, as an array...
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
179
Given a string in which words are separated by spaces, return the longest word.
Code Completion
Given a string in which words are separated by spaces, return the longest word.
CodeCheck
Strings
,
Words
180
Given a string in which words are separated by spaces, return the first word that is repeated somewhere in the string.
Code Completion
Given a string in which words are separated by spaces, return the first word that is repeated somewhere in the...
CodeCheck
Strings
,
Words
181
Given a string in which words are separated by spaces, return the first word that is duplicated (such as an accidental “this this”).
Code Completion
Given a string in which words are separated by spaces, return the first word that is duplicated (such as an...
CodeCheck
Strings
,
Words
182
Given an array of integers and an integer n, return an array of the averages of n consecutive elements of the original array.
Code Completion
Given an array of integers and an integer n, return an array of the averages of n consecutive elements of...
CodeCheck
Arrays - Simple Exercises
,
Sums
,
Averages
,
Products
183
Given an array of integers and two values a and b, return the sum of all elements that are at least a and at most b.
Code Completion
Given an array of integers and two values a and b, return the sum of all elements that are at...
CodeCheck
Arrays - Simple Exercises
,
Sums
,
Averages
,
Products
184
Given an array of strings and a string s, return the average length of all strings containing s.
Code Completion
Given an array of strings and a string s, return the average length of all strings containing s.
CodeCheck
Arrays - Simple Exercises
,
Sums
,
Averages
,
Products
185
Given two two-dimensional arrays of integers with the same number of rows and columns, return the first position where they do not match, as an array of length 2.
Code Completion
Given two two-dimensional arrays of integers with the same number of rows and columns, return the first position where they...
CodeCheck
Two-Dimensional Arrays
,
Producing 2D Arrays
186
Given two two-dimensional arrays with the same number of rows, return an array that places them side by side.
Code Completion
Given two two-dimensional arrays with the same number of rows, return an array that places them side by side.
CodeCheck
Two-Dimensional Arrays
,
Producing 2D Arrays
187
Given a two-dimensional array of integers and a row index, return the largest element in that row.
Code Completion
Given a two-dimensional array of integers and a row index, return the largest element in that row.
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
188
Given a two-dimensional array of integers and a column index, return the smallest element in that column.
Code Completion
Given a two-dimensional array of integers and a column index, return the smallest element in that column.
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
189
Given two arrays of integers of the same length, return the first position where their elements are the same.
Code Completion
Given two arrays of integers of the same length, return the first position where their elements are the same.
CodeCheck
Arrays - Simple Exercises
,
Finding Elements
190
Given two arrays of integers of the same length, return the first position where their elements differ.
Code Completion
Given two arrays of integers of the same length, return the first position where their elements differ.
CodeCheck
Arrays - Simple Exercises
,
Finding Elements
191
Given a two-dimensional array of integers and a string NW, NW, SW, SE, return the sum of the four elements in the given compass direction.
Code Completion
Given a two-dimensional array of integers and a string NW, NW, SW, SE, return the sum of the four elements...
CodeCheck
Two-Dimensional Arrays
,
No Loops
192
Given a two-dimensional array of integers, row/column indexes r, c, and a string N E S W, return the neighbor in that direction, or 0 if it doesn't exist.
Code Completion
Given a two-dimensional array of integers, row/column indexes r, c, and a string N E S W, return the neighbor...
CodeCheck
Two-Dimensional Arrays
,
No Loops
193
Given a two-dimensional array of integers and row/column indexes r, c, return the number of neighbors (not counting the element itself).
Code Completion
Given a two-dimensional array of integers and row/column indexes r, c, return the number of neighbors (not counting the element...
CodeCheck
Two-Dimensional Arrays
,
No Loops
194
Given three numbers x, y, z and a Boolean variable <code>strict</code>, return <code>true</code> if <code>strict</code> is false and x ≤ y ≤ z, or <code>strict</code> is true and x < y < z.
Code Completion
Given three numbers x, y, z and a Boolean variable
strict
, return
true
if
strict
is false and x ≤...
CodeCheck
Branches
,
Branches with Functions
195
Given four numbers a, b, c, d, return true if exactly two of them are the same.
Code Completion
Given four numbers a, b, c, d, return true if exactly two of them are the same.
CodeCheck
Branches
,
Branches with Functions
196
Given numbers x, y, and target, return whichever of x and y is closer to the target.
Code Completion
Given numbers x, y, and target, return whichever of x and y is closer to the target. If they have...
CodeCheck
Branches
,
Branches with Functions
197
Given a two-dimensional array of integers and row/column positions r, c, return the largest neighbor in the compass directions N E S W.
Code Completion
Given a two-dimensional array of integers and row/column positions r, c, return the largest neighbor in the compass directions N...
CodeCheck
Two-Dimensional Arrays
,
Looping over Neighbors
198
Given a two-dimensional array of integers and row/column positions r, c, return the largest neighbor in the compass directions N E S W NE NW SE SW.
Code Completion
Given a two-dimensional array of integers and row/column positions r, c, return the largest neighbor in the compass directions N...
CodeCheck
Two-Dimensional Arrays
,
Looping over Neighbors
199
Given a two-dimensional array of integers and row/column positions r, c, return the compass direction of the largest neighbor as a string N E S W NE NW SE SW.
Code Completion
Given a two-dimensional array of integers and row/column positions r, c, return the compass direction of the largest neighbor as...
CodeCheck
Two-Dimensional Arrays
,
Looping over Neighbors
200
Given a two-dimensional array a of integers and row/column positions r, c, return a 3x3 array whose middle element is a[r][c], and whose neighbors are copied from the original.
Code Completion
Given a two-dimensional array a of integers and row/column positions r, c, return a 3x3 array whose middle element is...
CodeCheck
Two-Dimensional Arrays
,
Looping over Neighbors
201
Given a two-dimensional array of integers, an index, and a string R or C, return the sum of the elements in that row or column.
Code Completion
Given a two-dimensional array of integers, an index, and a string R or C, return the sum of the elements...
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
202
Given a two-dimensional array of integers, a row index r, and a column index c, return the sum of all elements in the given row and column.
Code Completion
Given a two-dimensional array of integers, a row index r, and a column index c, return the sum of all...
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
203
Given a two-dimensional array of integers and a string N, E, S, W, return the sum of all elements of the border in the given compass direction.
Code Completion
Given a two-dimensional array of integers and a string N, E, S, W, return the sum of all elements of...
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
204
Given two two-dimensional arrays a and b of integers with the same number of rows and columns, return a list of the same size where each element is the greater of the corresponding elements in the two arrays.
Code Completion
Given two two-dimensional arrays a and b of integers with the same number of rows and columns, return a list...
CodeCheck
Two-Dimensional Arrays
,
Producing 2D Arrays
205
Given a string s, find the longest prefix that also occurs at the end (so that s = p + t + p), and return t, the string without the beginning and the end.
Code Completion
Given a string s, find the longest prefix that also occurs at the end (so that s = p +...
CodeCheck
Strings
,
Finding Substrings
206
Given a two-dimensional array of integers and row/column positions r, c, return the largest neighbor in the compass directions N E S W.
Code Completion
Given a two-dimensional array of integers and row/column positions r, c, return the largest neighbor in the compass directions N...
CodeCheck
Two-Dimensional Arrays
,
Looping over Neighbors
207
Given a two-dimensional array of integers and row/column positions r, c, return the compass direction of the largest neighbor as a string N E S W NE NW SE SW.
Code Completion
Given a two-dimensional array of integers and row/column positions r, c, return the compass direction of the largest neighbor as...
CodeCheck
Two-Dimensional Arrays
,
Looping over Neighbors
208
Given a two-dimensional array a of integers and row/column positions r, c, return a 3x3 array whose middle element is a[r][c], and whose neighbors are copied from the original.
Code Completion
Given a two-dimensional array a of integers and row/column positions r, c, return a 3x3 array whose middle element is...
CodeCheck
Two-Dimensional Arrays
,
Looping over Neighbors
209
Given a two-dimensional array of integers and row/column positions r, c, return the largest neighbor in the compass directions N E S W NE NW SE SW.
Code Completion
Given a two-dimensional array of integers and row/column positions r, c, return the largest neighbor in the compass directions N...
CodeCheck
Two-Dimensional Arrays
,
Looping over Neighbors
210
Given two two-dimensional arrays a and b of integers with the same number of rows and columns, return an array of the same size where each element is the greater of the corresponding elements in the two arrays.
Code Completion
Given two two-dimensional arrays a and b of integers with the same number of rows and columns, return an array...
CodeCheck
Two-Dimensional Arrays
,
Producing 2D Arrays
211
Given numbers x, y, and target, return whichever of x and y is closer to the target.
Code Completion
Given numbers x, y, and target, return whichever of x and y is closer to the target. If they have...
CodeCheck
Branches
,
Branches with Functions
212
Given three numbers x, y, z and a Boolean variable <code>strict</code>, return <code>true</code> if <code>strict</code> is false and x ≤ y ≤ z, or <code>strict</code> is true and x < y < z.
Code Completion
Given three numbers x, y, z and a Boolean variable
strict
, return
true
if
strict
is false and x ≤...
CodeCheck
Branches
,
Branches with Functions
213
Given four numbers a, b, c, d, return true if exactly two of them are the same.
Code Completion
Given four numbers a, b, c, d, return true if exactly two of them are the same.
CodeCheck
Branches
,
Branches with Functions
214
Given a two-dimensional array of integers, an index, and a string R or C, return the sum of the elements in that row or column.
Code Completion
Given a two-dimensional array of integers, an index, and a string R or C, return the sum of the elements...
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
215
Given a two-dimensional array of integers, a row index r, and a column index c, return the sum of all elements in the given row and column.
Code Completion
Given a two-dimensional array of integers, a row index r, and a column index c, return the sum of all...
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
216
Given a two-dimensional array of integers and a string N, E, S, W, return the sum of all elements of the border in the given compass direction.
Code Completion
Given a two-dimensional array of integers and a string N, E, S, W, return the sum of all elements of...
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
217
Given a string s, find the longest prefix that also occurs at the end (so that s = p + t + p), and return t, the string without the beginning and the end.
Code Completion
Given a string s, find the longest prefix that also occurs at the end (so that s = p +...
CodeCheck
Strings
,
Finding Substrings
218
Given a two-dimensional array of integers and a string NW, NW, SW, SE, return the sum of the four elements in the given compass direction.
Code Completion
Given a two-dimensional array of integers and a string NW, NW, SW, SE, return the sum of the four elements...
CodeCheck
Two-Dimensional Arrays
,
No Loops
219
Given a two-dimensional array of integers, row/column indexes r, c, and a string N E S W, return the neighbor in that direction, or 0 if it doesn't exist.
Code Completion
Given a two-dimensional array of integers, row/column indexes r, c, and a string N E S W, return the neighbor...
CodeCheck
Two-Dimensional Arrays
,
No Loops
220
Given a two-dimensional array of integers and row/column indexes r, c, return the number of neighbors (not counting the element itself).
Code Completion
Given a two-dimensional array of integers and row/column indexes r, c, return the number of neighbors (not counting the element...
CodeCheck
Two-Dimensional Arrays
,
No Loops
221
Extract uppercase letters from string
Code Completion
Modify the static return upperCase method in the MyMethods class so that it returns a string of the upper case...
CodeCheck
Recursion
222
Calculate Function
Define a function that returns the second value multiplied by two and added by the first value. The program should...
jsParsons
functions
223
Recursive Factorial
Define a function that returns the factorial of a given positive integer.
jsParsons
functions
,
recursion
,
search
,
search algorithms
,
sorting
,
sorting algorithms
224
Modulo is Even
Construct a function that will return True if a given number is even, otherwise false.
jsParsons
algorithm analysis
,
functions
,
if-else statement
225
Greatest Common Factor
Construct a program that recursively finds and returns the great common factor between of two integers.
PCEX
recursion
,
search
,
search algorithms
,
sorting
,
sorting algorithms
226
Greatest Common Factor Challenge
Construct a program that recursively finds and returns the great common factor between of two integers. This is a simple...
PCEX
recursion
227
Find vowels in string with recursive helper method
Code Completion
Complete the MyMethods class so that the static vowels method returns a string of the vowels of the string parameter....
CodeCheck
Recursion
228
Finding all matches for a predicate
Code Completion
Recall that a predicate is a method with a Boolean return value. The Predicate interface can be used to test...
CodeCheck
Generic Types
229
Finding the first match for a predicate
Code Completion
Recall that a predicate is a method with a Boolean return value. The Predicate interface can be used to test...
CodeCheck
Generic Types
230
Nested Calls
First define a calculate function and then define double function (that returns the given value doubled). Then write a program...
jsParsons
algorithm analysis
,
functions
231
Multiplication as recursive addition
Code Completion
Complete the multiply method in the MyMethods class so that it returns the product of the non-negative integer n multipled...
CodeCheck
Recursion
232
Recursive string reversal with helper method
Code Completion
Complete the static reverseHelper method so that the reverse method returns a String that is the reverse of the parameter...
CodeCheck
Recursion
233
Passing Values
Construct a function that increases the original integer's value by 1 and return the increased value's memory address.
PCEX
functions
,
value vs reference
234
Generic replicate method
Code Completion
Implement the generic replicate method. It should return a list containing multiple copies of the given value.
CodeCheck
Generic Types
235
Rotating the Array Values to the Left by One Position
Construct a program that has a method that receives an array of values and returns the array rotated to the...
PCEX
arrays
236
Rotating the Array Values to the Left by Two Position
Construct a program that has a method that receives an array of values and returns the array rotated to the...
PCEX
arrays
237
Rotating the Array Values to the Right by One Position
Construct a program that has a method that receives an array of values and returns the array rotated to the...
PCEX
arrays
238
Rotating the List Values to the Right by Two Position
Construct a program that has a function that receives a list of values and returns the list rotated to the...
PCEX
arrays
239
Power calculation
Construct a function which takes the base and the exponent as parameters and returns the base raised to the exponent....
jsParsons
while loop
240
Rotating the Array Values
Construct a program that has a method that receives an array of values and returns the array rotated to the...
PCEX
arrays
241
Concatenating Characters of Two Strings
Construct a program that has a function that receives two strings and returns a string formed from the given strings...
PCEX
strings
242
Rotating the List Values
Construct a program that has a function that receives a list of values and returns the list rotated to the...
PCEX
algorithm analysis
,
classes
,
data structures
,
list
,
stacks
243
Counting the Occurrences of One String in Another
Construct a program that has a function that receives a string and returns the number of times that the string...
PCEX
for loop
,
functions
,
strings
244
Rotating the Array Values to the Left by Two Position
Construct a program that has a method that receives an array of values and returns the array rotated to the...
PCEX
arrays
245
Rotating the Array Values to the Right by One Position
Construct a program that has a method that receives an array of values and returns the array rotated to the...
PCEX
arrays
246
Rotating the List Values to the Right by Two Position
Construct a program that has a function that receives a list of values and returns the list rotated to the...
PCEX
arrays
247
Concatenating Characters of Two Strings
Construct a program that has a function that receives two strings and returns a string formed from the given strings...
PCEX
strings
248
Rotating the List Values (Case 2)
Construct a program that has a function that receives a list of values and returns the list rotated to the...
PCEX
list
249
Rotating the List Values (Case 3)
Construct a program that has a function that receives a list of values and returns the list rotated to the...
PCEX
list
250
Rotating the List Values (Case 4)
Construct a program that has a function that receives a list of values and returns the list rotated to the...
PCEX
list
251
Counting the Occurrences of One String in Another
Construct a program that has a function that receives a string and returns the number of times that the string...
PCEX
functions
,
strings
252
Construct a function that uses Queue Structure
Construct a function that uses Queue Structure to solve a Josephus problem that removes the kth element in a given...
jsParsons
queue
253
Number of even and odd elements
Code Completion
Count the number of even and odd elements in an array of integers. Since you must return two counts, place...
CodeCheck
Arrays and Array Lists
254
Linked List Operations - Contains
In this example, we will implement the contains() method that accepts a value and returns True if the value is...
PCEX
255
Letter frequency
Construct a function which counts the frequency of each character in the string given as a parameter and returns a...
jsParsons
dictionaries
256
Recursively calculate the power of a number
Using recursion, complete the power method so that it returns the value of a to the power of b. Examples:...
PCEX
257
Recursively calculate the sum of all numbers from 1 to n
Using recursion, complete the sum1toN method so that it returns the total sum of all numbers from 1 to N....
PCEX
258
Use Recursion to calculate power
Using recursion, complete the power method so that it returns the value of a to the power of b. Examples:...
PCEX
259
Recursively calculate the power of a number Challenge
Using recursion, complete the power method so that it returns the value of a to the power of b. Examples:...
PCEX
260
Use Recursion to calculate total sum of all numbers from 1 to N.
Using recursion, complete the sum1toN method so that it returns the total sum of all numbers from 1 to N....
PCEX
261
Recursively calculate the sum of all numbers from 1 to n Challenge
Using recursion, complete the sum1toN method so that it returns the total sum of all numbers from 1 to N....
PCEX
262
Swap first and last name
Code Completion
Write a method getLastFirst whose parameter is a string containing a name such as "Harry Smith" and that returns a...
CodeCheck
Fundamental Data Types
263
Binary Search - 1
Construct a function that receives an array and a target element to be searched in the given array. If the...
PCEX
264
Binary Search - 1
Construct a function that receives an array and a target element to be searched in the given array. If the...
PCEX
265
The Class for Representing a Point in the Euclidean Plane (Case 2)
Construct a class that represents a point in the Euclidean plane. The class should contain data that represents the point’s...
PCEX
classes
,
objects
266
Updating elements to the new list
Construct a function which finds even numbers from the list given as a parameter, calculates the square of each such...
jsParsons
search algorithms
267
Updating the elements to the new list
Construct a function which finds even numbers from the list given as a parameter, calculates the square of each such...
jsParsons
search algorithms
268
Updating the elements to the new list
Construct a function which finds even numbers from the list given as a parameter, calculates the square of each such...
jsParsons
269
Remove dublicates from the list
Construct a function which creates a new list where it stores all elements except the duplicates from the list given...
jsParsons
270
Person and Employee Inheritance
Construct two classes: one represents a Person and another one represents an Employee that should be defined as Person's child...
PCEX
classes
,
objects
271
On a chessboard, positions are marked with a letter between a and h for the column and a number between 1 and 8 for the row.
Code Completion
On a chessboard, positions are marked with a letter between a and h for the column and a number between...
CodeCheck
Two-Dimensional Arrays
,
No Loops
272
On a chessboard, positions are marked with a letter between a and h for the column and a number between 1 and 8 for the row.
Code Completion
On a chessboard, positions are marked with a letter between a and h for the column and a number between...
CodeCheck
Branches
,
Branches with Functions
273
Given a list of integers and an integer n, remove all elementts > n or < -n.
Code Completion
Given a list of integers and an integer n, remove all elementts > n or < -n. Shift all remaining...
CodeCheck
Lists - Simple Exercises
,
Moving or Removing Elements
274
Given a string, find the sum of all integers inside.
Code Completion
Given a string, find the sum of all integers inside. Return 0 if there is no integer inside.
CodeCheck
Strings
,
Numbers in Strings
275
JLinkedListUtil
This LinkedListUtil class tests various usages of the LinkedList class. The single param is an array of string. You will...
PCEX
276
JLinkedListUtil Challenge
This LinkedListUtil class tests various usages of the LinkedList class. The single param is an array of string. You will...
PCEX
277
The Class for Representing a Point in the Euclidean Plane (Case 2)
Construct a class that represents a point in the Euclidean plane. The class should contain data that represents the point’s...
PCEX
classes
,
constructors
,
exceptions
,
file i/o
,
inheritance
,
methods
,
objects
,
overloading
278
Letter frequency (count)
Code Completion
Write a method that computes how often each letter A-Z or a-z occurs in a string. Don't distinguish between upper-...
CodeCheck
Arrays and Array Lists
279
Letter frequency (percentage)
Code Completion
Write a method that computes the frequency (as a percentage between 0.0 and 1.0) of each letter A-Z or a-z...
CodeCheck
Arrays and Array Lists
280
BankAccount with Transaction Count
Code Completion
Change the deposit and withdraw methods of the BankAccount class so that a count of transactions is updated. For example,...
CodeCheck
Classes
281
XML Map Labels
Code Completion
The latitude, longitude and place name are used to label a map. Implement a class with latitude and longitude as...
CodeCheck
Classes
282
Reading a serialized array of objects
Code Completion
Your task is to read a serialized array of objects. You are given a FileInputStream, and you need to read...
CodeCheck
Advanced Input and Output
283
Find longest word in file
Code Completion
Your task is to open a file, read all words in the file, and find the longest word in the...
CodeCheck
Input and Output
284
Stutter
Code Completion
Your task is to write a method stutter that repeats all letters t in a string. For example, the call...
CodeCheck
Loops
285
EvenSum
Code Completion
Your task is to write a method evenSum that computes the sum of all even numbers between two given numbers....
CodeCheck
Loops
286
GetVowels
Code Completion
Your task is to write a method getVowels that gets the vowels in a string. For example, the call getVowels("Hello,...
CodeCheck
Loops
287
Count perfect squares
Code Completion
Your task is to write a method countPerfectSquares that counts all perfect squares in a given range. For example, the...
CodeCheck
Loops
288
Count Sevens
Code Completion
Your task is to write a method countSevens that counts the number of digits equal to 7 in a given...
CodeCheck
Loops
289
Given a string, find the sum of all integers inside.
Code Completion
Given a string, find the sum of all integers inside. Return 0 if there is no integer inside.
CodeCheck
Strings
,
Numbers in Strings
290
Last n Characters
Code Completion
Write a method that gets the last n characters from a string. For example, last("Hello, World!", 5) should return the...
CodeCheck
Fundamental Data Types
291
Initials
Code Completion
Complete the initials method in the class below. For example, the call initials("Harry", "Joseph", "Hacker") should return the string "HJH".
CodeCheck
Fundamental Data Types
292
Middle Letter
Code Completion
Complete the getMiddle method that gets the middle character from a word if the word length is odd, or the...
CodeCheck
Branches
293
On a chessboard, positions are marked with a letter between a and h for the column and a number between 1 and 8 for the row.
Code Completion
On a chessboard, positions are marked with a letter between a and h for the column and a number between...
CodeCheck
Branches
,
Branches with Functions
294
Given an array of integers and an integer n, remove all elementts > n or < -n.
Code Completion
Given an array of integers and an integer n, remove all elementts > n or < -n. Shift all remaining...
CodeCheck
Arrays - Simple Exercises
,
Moving or Removing Elements
295
On a chessboard, positions are marked with a letter between a and h for the column and a number between 1 and 8 for the row.
Code Completion
On a chessboard, positions are marked with a letter between a and h for the column and a number between...
CodeCheck
Two-Dimensional Arrays
,
No Loops
296
Creating a Dictionary of Student-Scores Pairs
Assume we have a list of students and a list of their corresponding test scores. Construct a program that has...
PCEX
dictionaries
,
dictionary
297
Creating a Dictionary of Student-Scores Pairs
Assume we have a list of students and a list of their corresponding test scores. Construct a program that has...
PCEX
dictionaries
,
dictionary
298
Using an Abstract Class
Code Completion
Light bulbs can be identified by type and can be measured by the amount of lumens produced per watt of...
CodeCheck
Inheritance
299
An enum type describing chemical elements
Code Completion
Enumerated types in Java are quite powerful, in that they can contain methods and instance variables. An enum type class...
CodeCheck
Inheritance
300
Number guessing game
Code Completion
A simple guessing game asks the player to guess a number between 1 and 50. Hints are returned depending on...
CodeCheck
Branches
301
Static field to maintain the total value of Coin objects created
Code Completion
Add a private static variable to the Coin class that maintains the total value of all coins that were constructed....
CodeCheck
Designing Classes
302
Static field to count number of objects
Code Completion
Add a private static variable to the Coin class that counts the total number of coins that were constructed. Also...
CodeCheck
Designing Classes
303
Vending Machine With Dollars and Quarters
Suppose we have a vending machine that gives change. A customer selects an item for purchase and inserts a bill...
PCEX
304
Vending Machine With Quarters-Dimes- and Nickels
Suppose we have a vending machine that gives change. A customer selects an item for purchase and inserts a bill...
PCEX
305
Vending Machine With Dollars and Quarters
Suppose we have a vending machine that gives change. A customer selects an item for purchase and inserts a bill...
PCEX
operators
,
primitive data types
,
variables
306
Vending Machine With Quarters-Dimes- and Nickels
Suppose we have a vending machine that gives change. A customer selects an item for purchase and inserts a bill...
PCEX
operators
,
primitive data types
,
variables
307
Vending Machine With Dollars and Quarters
Suppose we have a vending machine that gives change. A customer selects an item for purchase and inserts a bill...
PCEX
308
Vending Machine With Quarters-Dimes- and Nickels
Suppose we have a vending machine that gives change. A customer selects an item for purchase and inserts a bill...
PCEX
309
Queue Class - Check if Element Exists
In this example, you will use Queue class from queue provided by python. This class contains methods for adding a...
PCEX
310
Queue Class - Check if Element Exists
In this example, you will use Queue class from queue provided by python. This class contains methods for adding a...
PCEX
311
Solving Josephus Problem Challenge
Construct a program by using Queue structure to solve a Josephus problem. Josephus problem is a counting-out game. N people...
PCEX
312
Vending Machine
Suppose we have a vending machine that gives change. A customer selects an item for purchase and inserts a bill...
PCEX
arithmetic operators
,
constants
,
operators
,
primitive data types
,
variables
313
Vending Machine
Suppose we have a vending machine that gives change. A customer selects an item for purchase and inserts a bill...
PCEX
operators
,
variables
314
Vending Machine With Quarters, Dimes, and Nickels
Suppose we have a vending machine that gives change. A customer selects an item for purchase and inserts a bill...
PCEX
arithmetic operators
,
constants
,
operators
,
primitive data types
,
variables
315
The Class for Representing a Point in the Euclidean Plane
Construct a class that represents a point in the Euclidean plane. The class should contain data that represents the point’s...
PCEX
classes
,
objects
316
Vending Machine
Suppose we have a vending machine that gives change. A customer selects an item for purchase and inserts a bill...
PCEX
operators
,
variables
317
Swap adjacent characters in a RandomAccessFile
Code Completion
Your task is to swap adjacent letters in a RandomAccessFile. Simply read two bytes, back up by two bytes, and...
CodeCheck
Advanced Input and Output
318
Normalizing Angles
Code Completion
When you work with angle measurements, you often want them normalized or converted into the range between 0 . ....
CodeCheck
Fundamental Data Types
319
Make a measurer for words
Code Completion
In this exercise, we use the Word class from chapter 6 (with the bugs fixed). You should not change the...
CodeCheck
Interfaces
320
Using instanceof for Converting Between Animal Types
Code Completion
The Cat and Dog class below implement the Animal interface. All animals have names, but only dogs do tricks. Implement...
CodeCheck
Interfaces
321
Search in the linked list.
When using a LinkedList, it is possible that you may want to search through the list to see if a...
PCEX
linked list
,
search algorithms
322
Recursive Binary Search
Construct a function that uses recursive binary search to find if a specific value is in a list (known as...
PCEX
recursion
,
search
,
search algorithms
,
sorting
323
Binary search
Binary Search operates by dividing an array in half, and then determining whether or not the target value would be...
PCEX
binary search
,
recursion
,
search
,
search algorithms
,
sorting
,
trees
324
Search in the linked list. Challenge
When using a LinkedList, it is possible that you may want to search through the list to see if a...
PCEX
search algorithms
325
Recursive Binary Search Challenge
Construct a function that uses recursive binary search to find if a specific value is in a list (known as...
PCEX
recursion
,
search algorithms
326
Binary search Challenge
Binary Search operates by dividing an array in half, and then determining whether or not the target value would be...
PCEX
search algorithms
327
XML Map Labels convert to decimal degrees
Code Completion
The latitude, longitude and place name are used to label a map. Implement a class with latitude and longitude as...
CodeCheck
Classes
×
This is a detailed description.