-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgithub-practice
More file actions
71 lines (63 loc) · 2.04 KB
/
Copy pathgithub-practice
File metadata and controls
71 lines (63 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
* Calculates the total area of rectangles given an array of rectangle dimensions.
*
* @param {number[][]} rectangles - An array of rectangles, where each rectangle is represented by [length, width].
* @returns {number} - The total area of all rectangles.
*/
function calculateTotalArea(rectangles) {
// Implementation is intentionally omitted in this file.
}
/**
* Finds and returns the largest element in an array of numbers.
*
* @param {number[]} numbers - The array of numbers.
* @returns {number|null} - The largest element or null if the array is empty.
*/
function findLargestElement(numbers) {
// Implementation is intentionally omitted in this file.
}
/**
* Checks if a given string is a palindrome.
*
@param {string} inputString - The input string to check.
* @returns {boolean} - True if the string is a palindrome, false otherwise.
*/
function isPalindrome(inputString) {
// Implementation is intentionally omitted in this file.
}
/**
* Counts the occurrences of a specific element in an array.
*
* @param {Array} array - The array of elements.
* @param {*} targetElement - The element to count occurrences of.
* @returns {number} - The number of occurrences of the target element.
*/
function countOccurrences(array, targetElement) {// Marcus
// Implementation is intentionally omitted in this file.
let countOcc = 0;
for (let element of array) {
if( element === targetElement) {
countOcc ++;
}
}
return countOcc;
}
/**
* Merges two sorted arrays into a new sorted array.
*
* @param {number[]} arr1 - The first sorted array.
* @param {number[]} arr2 - The second sorted array.
* @returns {number[]} - The merged and sorted array.
*/
function mergeSortedArrays(arr1, arr2) {
// Implementation is intentionally omitted in this file.
}
/**
* Calculates the factorial of a non-negative integer.
*
* @param {number} n - The non-negative integer.
* @returns {number} - The factorial of the given number.
*/
function calculateFactorial(n) {
// Implementation is intentionally omitted in this file.
}