Duplicate Character Counter
Function Name: countDuplicateCharacters
Description
Write a function named 'countDuplicateCharacters' that takes a single string as an input and returns a dictionary (or an object/map depending on the language) containing the counts of duplicate characters in that string. The function should be case-sensitive, meaning 'a' and 'A' should be counted as distinct characters. Characters that do not repeat should not be included in the result.
Requirements
- The function must be named 'countDuplicateCharacters'.
- The function takes exactly one parameter: a string.
- The function returns a dictionary/object/map where the keys are characters that appear more than once in the string, and the values are the counts of those characters' occurrences.
- The counting should be case-sensitive.
- Exclude non-repeating characters from the result.
- Do not use any built-in language features or third-party libraries that directly solve the challenge.
Examples
Given the function call countDuplicateCharacters('programming'), the expected output is {'r': 2, 'g': 2, 'm': 2}.Given the function call countDuplicateCharacters('abstraction'), the expected output is {'a': 2, 't': 2}.Given the function call countDuplicateCharacters('Hello World'), the expected output is {'l': 3, 'o': 2}.
Links
Treasure Map Decoder
Mon Aug 19 2024
You have found an ancient treasure map divided into a grid with each cell containing a number. The number represents the number of steps you need to move from the current cell. You can only move either right or down.Write a function 'decodeTreasureMap' that takes a 2D array representing the map and returns the number of unique paths that lead to the treasure. The treasure is marked with the number 0, and it will only be present once, at the lower-right corner of the grid. You start your journey from the top-left corner of the map. A step must bring you closer to the treasure; therefore, you cannot move left or up.
Matrix Diagonal Sum
Wed Aug 21 2024
This challenge requires the developer to implement a function that calculates the sum of the elements on the primary diagonal of a square matrix (2D array).A square matrix is a matrix with the same number of rows and columns.The primary diagonal is the diagonal that extends from the top left corner to the bottom right corner of the square matrix.