Code Problem / Data Structures and Algorithms / Arrays and Strings

Categories: Code Problem / Data Structures and Algorithms / Recursion (32) Code Problem / Data Structures and Algorithms / Binary Search (30) Code Problem / Data Structures and Algorithms / Linked Lists (26) Code Problem / Data Structures and Algorithms / Backtracking (26) Code Problem / Data Structures and Algorithms / Stacks and Queues (25) Code Problem / Data Structures and Algorithms / Hashing (24) Databases / SQL / Backup and Recovery (19) Code Problem / Data Structures and Algorithms / Arrays and Strings (19) Databases / SQL / Database Normalization (18) Code Problem / Data Structures and Algorithms / Time Complexity (17) Databases / SQL / Locking (16) Databases / SQL / Replication (15) Databases / SQL / SQL Queries (13) Code Problem / Data Structures and Algorithms / Graphs (13) Databases / SQL / Database Security (13)  More...

Recent solutions:

Check these solutions from our community:
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
This problem asks us to develop an algorithm that can determine whether or not a given string has all unique characters. For example, the input string "abcdefg" would return True, while the input string "aabbcc" would return False.
About this solution: The candidate's solution is correct and uses an efficient approach. The time complexity of the solution is O(n) and the space complexity is O(n).
Dec 12
Code Problem / Data Structures and Algorithms DifficultyMedium JavaScript
The "Array Sum" code problem asks the programmer to return the sum of the elements in an array of integers. An example input would be [1, 2, 3, 4], and the corresponding output would be 10.
About this solution: This is a great solution! The candidate has clearly thought through the problem and has provided a very efficient solution.
Dec 11
Code Problem / Data Structures and Algorithms DifficultyMedium C++
Given a string, this function finds the first non-repeating character in it.
About this solution: The candidate's solution correctly finds the first non-repeating character in a string. The solution uses a hash map to keep track of the number of times each character appears in the string, then loops through the string again to find the first character with a count of 1. One potential improvement to this solution would be to use a LinkedHashMap instead of a regular hash map, so that the order in which the characters are added to the map is preserved. This would allow the solution to find the first non-repeating character in the string in a single loop, without having to loop through the string twice.
Dec 10
Code Problem / Data Structures and Algorithms DifficultyMedium C#
Find the first non-repeating character in a given string.
About this solution: The candidate's solution correctly solves the problem and uses a reasonable approach.
Dec 04
Code Problem / Data Structures and Algorithms DifficultyMedium C++
Given an array of positive integers and a positive integer s, this function returns the minimal length of a contiguous subarray of which the sum is greater than or equal to s. If there isn 't one, it returns 0 instead.
About this solution: This is a great solution! The candidate has taken the time to include comments explaining what the code is doing, which is always appreciated. The code itself is clean and well-organized.
Dec 04
Code Problem / Data Structures and Algorithms DifficultyMedium C++
This problem deals with finding the first non-repeating character in a given string. For example, if the input string is "GeeksforGeeks", then the output should be ' f'.
About this solution: The candidate's solution correctly finds the first non-repeating character in a string. The solution uses a hash map to keep track of the number of times each character appears in the string, then loops through the string again to find the first character with a count of 1. One potential improvement to this solution would be to use a LinkedHashMap instead of a regular hash map. This would allow the characters to be iterated over in the order in which they appear in the string, which would make the second loop unnecessary.
Dec 03
Code Problem / Data Structures and Algorithms DifficultyMedium C#
The problem is to find the sum of the elements in an array of integers. An example input would be [1, 2, 3, 4, 5], and the corresponding output would be 15.
About this solution: The candidate's solution does not demonstrate a level of completeness and does not solve the problem. The general approach is not clear.
Dec 03
Code Problem / Data Structures and Algorithms DifficultyMedium C++
Given an array of n integers, the maximum sum of any contiguous subarray of the array can be found by using the example input and output above.
About this solution: The candidate's solution correctly finds the maximum sum of any contiguous subarray of the array. The candidate's approach is to keep track of the current sum and update the maximum sum as needed. This is a good approach.
Dec 01