Skip to main content

All Questions

5 votes
2 answers
915 views

Matrix of articles and authors from large JSON dataset

Given the following JSON data containing 4 articles by 4 different authors: ...
CodeYogi's user avatar
  • 5,137
3 votes
1 answer
466 views

Determine whether any permutation of a string is a palindrome

The task: Given a string, determine whether any permutation of it is a palindrome. For example, "carrace" should return true, since it can be rearranged to ...
thadeuszlay's user avatar
  • 3,981
3 votes
2 answers
1k views

Find the elements that appear only once

The task: Given an array of integers in which two elements appear exactly once and all other elements appear exactly twice, find the two elements that appear only once. For example, given ...
thadeuszlay's user avatar
  • 3,981
5 votes
1 answer
323 views

Find the starting indices of all occurrences of the pattern in the string - KMP algorithm follow-up

The task was initially solved here, but was too buggy: Given a string and a pattern, find the starting indices of all occurrences of the pattern in the string. For example, given the string "...
thadeuszlay's user avatar
  • 3,981
5 votes
3 answers
3k views

Reverse Integer

The task is taken from leetcode Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: ...
thadeuszlay's user avatar
  • 3,981
5 votes
1 answer
299 views

Container with most water

The task is taken from leetcode Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of ...
thadeuszlay's user avatar
  • 3,981
4 votes
2 answers
1k views

Check whether string of braces, brackets, and parentheses is balanced

The Task is taken from codewars: Write a function that takes a string of braces, and determines if the order of the braces is valid. It should return true if ...
thadeuszlay's user avatar
  • 3,981
3 votes
1 answer
2k views

Maze path finder using Depth-First Search algorithm

I'm trying to resolve this kata from CodeWars. Kata exercise You are at position [0, 0] in maze NxN and you can only move in one of the four cardinal directions (i.e. North, East, South, West). ...
Ender Look's user avatar
3 votes
3 answers
823 views

Rotate a linked list to the right by k places

The task Given a linked list and a positive integer k, rotate the list to the right by k places. For example, given the linked list 7 -> 7 -> 3 -> 5 and k = 2, it should become 3 -> 5 -> 7 -...
thadeuszlay's user avatar
  • 3,981
3 votes
2 answers
7k views

Given time intervals, find the minimum number of conference rooms required

The task is taken from LeetCode Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required. ...
thadeuszlay's user avatar
  • 3,981
1 vote
3 answers
399 views

Find the starting indices of all occurrences of the pattern in the string [closed]

The task Given a string and a pattern, find the starting indices of all occurrences of the pattern in the string. For example, given the string "abracadabra" and the pattern "abr", you should ...
thadeuszlay's user avatar
  • 3,981
1 vote
2 answers
245 views

First Unique Character in a String

The task is taken from leetcode Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: s = "leetcode" return ...
thadeuszlay's user avatar
  • 3,981
1 vote
2 answers
2k views

Minimum number of parentheses to be removed to make a string of parentheses balanced

The task: Given a string of parentheses, write a function to compute the minimum number of parentheses to be removed to make the string valid (i.e. each open parenthesis is eventually closed). ...
thadeuszlay's user avatar
  • 3,981