Download results
Showing 0–0 of 0 results
Items per page:
10
25
50
100
#
Exercise Title
Features
Description
Platform
Keywords
1
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
2
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
3
Given a two-dimensional array of integers and a string N, E, S, W, give the middle element along the border in the given compass direction, or the average of the two middle ones if the border length is even.
Code Completion
Given a two-dimensional array of integers and a string N, E, S, W, give the middle element along the border...
CodeCheck
Two-Dimensional Arrays
,
No Loops
4
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
5
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
6
Repeat with NW NE SW SE.
Code Completion
Repeat with NW NE SW SE.
CodeCheck
Two-Dimensional Arrays
,
No Loops
7
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
8
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
9
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
10
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
11
Given a list of integers, swap the first and last elements.
Code Completion
Given a list of integers, swap the first and last elements.
CodeCheck
Lists - Simple Exercises
,
No loops
12
Given a list of integers, swap the first two and the last two elements.
Code Completion
Given a list of integers, swap the first two and the last two elements.
CodeCheck
Lists - Simple Exercises
,
No loops
13
Given an input string, print the string with the first and last letter removed if they were equal, or the original string if they were not.
Code Completion
Given an input string, print the string with the first and last letter removed if they were equal, or the...
CodeCheck
Branches
,
Branches Without Functions
14
Given an actual time and an alarm clock time, both in “military” format (such as 0730 for 7:30am), print how many more minutes before the alarm rings.
Code Completion
Given an actual time and an alarm clock time, both in “military” format (such as 0730 for 7:30am), print how...
CodeCheck
Branches
,
Branches Without Functions
15
Repeat the preceding exercise for U.
Code Completion
Repeat the preceding exercise for U.S. time (e.g. 7:30am).
CodeCheck
Branches
,
Branches Without Functions
16
Given a point with integer coordinates (x, y) and a compass direction N, E, S, W, print the neigboring lattice point.
Code Completion
Given a point with integer coordinates (x, y) and a compass direction N, E, S, W, print the neigboring lattice...
CodeCheck
Branches
,
Branches Without Functions
17
Repeat with compass directions NW, NE, SW, SE.
Code Completion
Repeat with compass directions NW, NE, SW, SE.
CodeCheck
Branches
,
Branches Without Functions
18
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 Without Functions
19
On a chessboard, fields 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, fields are marked with a letter between a and h for the column and a number between...
CodeCheck
Branches
,
Branches Without Functions
20
Given the x- and y-coordinates of a point, print whether the point lies in the first, second, third, or fourth quadrant plane, or on the x-axis, or on the y-axis, or the origin.
Code Completion
Given the x- and y-coordinates of a point, print whether the point lies in the first, second, third, or fourth...
CodeCheck
Branches
,
Branches Without Functions
21
Given three numbers x, y, z, determine if one of them is the sum of the two others, and then print out the equation.
Code Completion
Given three numbers x, y, z, determine if one of them is the sum of the two others, and then...
CodeCheck
Branches
,
Branches Without Functions
22
Given three numbers x, y, z, print out how whether they are all distinct, two are the same, or all three are the same.
Code Completion
Given three numbers x, y, z, print out how whether they are all distinct, two are the same, or all...
CodeCheck
Branches
,
Branches Without Functions
23
Given two integers x and y, print their sum, but if it is more than 100 or less than 0, print "out of range".
Code Completion
Given two integers x and y, print their sum, but if it is more than 100 or less than 0,...
CodeCheck
Branches
,
Branches Without Functions
24
Given three integers x, y, z, print the sum of the odd integers.
Code Completion
Given three integers x, y, z, print the sum of the odd integers.
CodeCheck
Branches
,
Branches Without Functions
25
Given three input strings, print all but the shortest one.
Code Completion
Given three input strings, print all but the shortest one.
CodeCheck
Branches
,
Branches Without Functions
26
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
27
Given a two-dimensional array of integers, remove any adjacent duplicate rows by filling the duplicates with zeroes.
Code Completion
Given a two-dimensional array of integers, remove any adjacent duplicate rows by filling the duplicates with zeroes.
CodeCheck
Two-Dimensional Arrays
,
Complex Loops
28
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
29
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
30
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
31
Repeat the previous exercise with subarrays that are not necessarily square.
Code Completion
Repeat the previous exercise with subarrays that are not necessarily square.
CodeCheck
Two-Dimensional Arrays
,
Complex Loops
32
Given a list of integers, count how many elements are negative.
Code Completion
Given a list of integers, count how many elements are negative.
CodeCheck
Lists - Simple Exercises
,
Counting Elements
33
Given a list a, count how many times the ith element from the front equals the ith element from the back.
Code Completion
Given a list a, count how many times the ith element from the front equals the ith element from the...
CodeCheck
Lists - Simple Exercises
,
Counting Elements
34
Given a list of integers and two values a and b, count how many elements are at least a and at most b.
Code Completion
Given a list of integers and two values a and b, count how many elements are at least a and...
CodeCheck
Lists - Simple Exercises
,
Counting Elements
35
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
36
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
37
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
38
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
39
Given a list of integers, remove all elements that occur more than once, leaving the first occurrence.
Code Completion
Given a list of integers, remove all elements that occur more than once, leaving the first occurrence.
CodeCheck
Lists - Simple Exercises
,
Counting Elements
40
Given two lists of integers a and b of the same length, count the number of positions where the lists have the same elements.
Code Completion
Given two lists of integers a and b of the same length, count the number of positions where the lists...
CodeCheck
Lists - Simple Exercises
,
Counting Elements
41
Given two lists of integers a and b of the same length, count the number of positions where the list elements differ by at least 2.
Code Completion
Given two lists of integers a and b of the same length, count the number of positions where the list...
CodeCheck
Lists - Simple Exercises
,
Counting Elements
42
Given two lists a and b, remove all elements of b from a.
Code Completion
Given two lists a and b, remove all elements of b from a.
CodeCheck
Lists - Simple Exercises
,
Double Loops
43
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
44
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
45
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
46
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
47
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
48
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
49
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
50
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
51
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
52
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
53
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
54
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
55
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
56
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
57
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
58
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
59
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
60
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
61
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
62
Write a function that checks whether two points with coordinates x1, y1 and x2, y2 are in the same quadrant.
Code Completion
Write a function that checks whether two points with coordinates x1, y1 and x2, y2 are in the same quadrant.
CodeCheck
Branches
,
Branches with Functions
63
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
64
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
65
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
66
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
67
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
68
Repeat for four numbers.
Code Completion
Repeat for four numbers. Hint: Use the previous problem.
CodeCheck
Branches
,
Branches with Functions
69
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
70
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
71
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
72
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
73
Given a two-dimensional array of integers, row/column positions r, c, and a value x, fill the given element and its neighbors in the compass directions N E S W NE NW SE SW with x.
Code Completion
Given a two-dimensional array of integers, row/column positions r, c, and a value x, fill the given element and its...
CodeCheck
Two-Dimensional Arrays
,
Looping over Neighbors
74
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
75
Given a two-dimensional array of integers, compute the sum of all positive elements.
Code Completion
Given a two-dimensional array of integers, compute the sum of all positive elements.
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
76
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
77
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
78
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
79
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
80
Given a two-dimensional array of integers, compute the sum of all elements that are not one of the borders.
Code Completion
Given a two-dimensional array of integers, compute the sum of all elements that are not one of the borders.
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
81
Given a two-dimensional square array of integers, compute the sum of all elements that are not on one of the diagonals.
Code Completion
Given a two-dimensional square array of integers, compute the sum of all elements that are not on one of the...
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
82
Given a two-dimensional array of integers, replace all negative elements with zero.
Code Completion
Given a two-dimensional array of integers, replace all negative elements with zero.
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
83
Given a two-dimensional array of integers, reverse all rows.
Code Completion
Given a two-dimensional array of integers, reverse all rows.
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
84
Given a two-dimensional array of integers, shift each row by one to the right and put a 0 at the leftmost column.
Code Completion
Given a two-dimensional array of integers, shift each row by one to the right and put a 0 at the...
CodeCheck
Two-Dimensional Arrays
,
Looping Over the Entire Array
85
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
86
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
87
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
88
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
89
Given a two-dimensional array of integers and a row index r, reverse the given row.
Code Completion
Given a two-dimensional array of integers and a row index r, reverse the given row.
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
90
Given a two-dimensional square array of integers, reverse both diagonals.
Code Completion
Given a two-dimensional square array of integers, reverse both diagonals.
CodeCheck
Two-Dimensional Arrays
,
Loops Along a Row or Column
91
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
92
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
93
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
94
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
95
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
96
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
97
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
98
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
99
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
100
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
101
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
102
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
103
Given a list of integers, swap the the maximum and minimum.
Code Completion
Given a list of integers, swap the the maximum and minimum.
CodeCheck
Lists - Simple Exercises
,
Maximum and Minimum
104
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
105
Given a list of elements, find the shortest distance between two consecutive elements.
Code Completion
Given a list of elements, find the shortest distance between two consecutive elements.
CodeCheck
Lists - Simple Exercises
,
Maximum and Minimum
106
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
107
Given a list of integers, move all zeroes to the back.
Code Completion
Given a list of integers, move all zeroes to the back.
CodeCheck
Lists - Simple Exercises
,
Moving or Removing Elements
108
Given a list of integers, move all zeroes to the front.
Code Completion
Given a list of integers, move all zeroes to the front.
CodeCheck
Lists - Simple Exercises
,
Moving or Removing Elements
109
Given a list of integers, move all negative numbers to the front and all positive numbers to the back, keeping their relative order.
Code Completion
Given a list of integers, move all negative numbers to the front and all positive numbers to the back, keeping...
CodeCheck
Lists - Simple Exercises
,
Moving or Removing Elements
110
Given a list of integers, remove all even elements that occur exactly twice.
Code Completion
Given a list of integers, remove all even elements that occur exactly twice.
CodeCheck
Lists - Simple Exercises
,
Moving or Removing Elements
111
Given a list of integers, remove all adjacent duplicates.
Code Completion
Given a list of integers, remove all adjacent duplicates.
CodeCheck
Lists - Simple Exercises
,
Moving or Removing Elements
112
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
113
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
114
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
115
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
116
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
117
Write a method that undoes the effect of the preceding exercise.
Code Completion
Write a method that undoes the effect of the preceding exercise.
CodeCheck
Strings
,
Other String Operations
118
Given a string and two characters x and y (as strings of length 1), interchange all occurrences of x and y.
Code Completion
Given a string and two characters x and y (as strings of length 1), interchange all occurrences of x and...
CodeCheck
Strings
,
Other String Operations
119
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
120
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
121
Given an integer n, produce the array <pre>0 1 2 3 .
Code Completion
Given an integer n, produce the array
0 1 2 3 ... n 1 2 3 4 ... 0 ......
CodeCheck
Two-Dimensional Arrays
,
Producing 2D Arrays
122
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
123
Repeat the preceding exercise where the array dimensions need not match, filling positions that exist in neither array with 0.
Code Completion
Repeat the preceding exercise where the array dimensions need not match, filling positions that exist in neither array with 0.
CodeCheck
Two-Dimensional Arrays
,
Producing 2D Arrays
124
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
125
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
126
Repeat where the row lengths don't have to match.
Code Completion
Repeat where the row lengths don't have to match. Fill the shorter array with zeroes.
CodeCheck
Two-Dimensional Arrays
,
Producing 2D Arrays
127
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
128
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
129
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
130
Given a string s, count how many times the ith character from the front equals the ith character from the back.
Code Completion
Given a string s, count how many times the ith character from the front equals the ith character from the...
CodeCheck
Strings
,
Comparing Strings
131
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
132
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
133
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
134
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
135
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
136
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
137
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
138
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
139
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
140
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
141
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
142
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
143
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
144
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
145
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
146
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
147
Given a string in which words are separated by spaces, and two words a and b, interchange all occurrences of a and b.
Code Completion
Given a string in which words are separated by spaces, and two words a and b, interchange all occurrences of...
CodeCheck
Strings
,
Words
148
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
149
Given a list of integers, find the largest sum of two different elements in the list.
Code Completion
Given a list of integers, find the largest sum of two different elements in the list.
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
150
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
151
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
152
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
153
Given a list of integers, replace each element with the average of its neighbors.
Code Completion
Given a list of integers, replace each element with the average of its neighbors.
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
154
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
155
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
156
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
157
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
158
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
159
Given a list of integers, give the largest n so that the sum of the first n elements equals the sum of the remaining elements.
Code Completion
Given a list of integers, give the largest n so that the sum of the first n elements equals the...
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
160
Given a list of integers, give the largest n ≤ length / 2 so that the sum of the first n elements equals the sum of the last n elements.
Code Completion
Given a list of integers, give the largest n ≤ length / 2 so that the sum of the first...
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
161
Given a list of integers, give the largest sum of n consecutive elements.
Code Completion
Given a list of integers, give the largest sum of n consecutive elements.
CodeCheck
Lists - Simple Exercises
,
Sums
,
Averages
,
Products
162
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
163
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
164
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
165
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
166
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
×
This is a detailed description.