This is a problem from Leetcode - Split a String in Balanced Strings.
Balanced strings are those who have equal quantity of ‘L’ and ‘R’ characters.
Given a balanced string s split it in the maximum amount of balanced strings.
Return the maximum amount of splitted balanced strings.
- Oct 13, 2019...more
- Oct 12, 2019...more
This is a problem from Leetcode - Queens That Can Attack the King.
On an 8x8 chessboard, there can be multiple Black Queens and one White King.
Given an array of integer coordinates queens that represents the positions of the Black Queens, and a pair of coordinates king that represent the position of the White King, return the coordinates of all the queens (in any order) that can attack the King.
- Oct 11, 2019...more
This is a problem from Leetcode - Maximum Swap.
Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get.
- Oct 10, 2019...more
This is a problem from Leetcode - Remove Zero Sum Consecutive Nodes from Linked List.
Given the head of a linked list, we repeatedly delete consecutive sequences of nodes that sum to 0 until there are no such sequences.
After doing so, return the head of the final linked list. You may return any such answer.
- Oct 8, 2019...more
This is a problem from Leetcode - Longest Arithmetic Subsequence of Given Difference.
Given an integer array arr and an integer difference, return the length of the longest subsequence in arr which is an arithmetic sequence such that the difference between adjacent elements in the subsequence equals difference.
- Oct 7, 2019...more
This is a problem from Leetcode - Path with Maximum Gold.
In a gold mine grid of size m * n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty.
Return the maximum amount of gold you can collect under the conditions:
- Every time you are located in a cell you will collect all the gold in that cell.
- From your position you can walk one step to the left, right, up or down.
- You can’t visit the same cell more than once.
- Never visit a cell with 0 gold.
- You can start and stop collecting gold from any position in the grid that has some gold.
- Oct 6, 2019...more
This is a problem from Hackerrank - Absolute Permutation.
For more information you can go to the problem details page.
- Oct 4, 2019...more
This is a problem from Leetcode - Remove All Adjacent Duplicates in String II.
Given a string s, a k duplicate removal consists of choosing k adjacent and equal letters from s and removing them causing the left and the right side of the deleted substring to concatenate together.
We repeatedly make k duplicate removals on s until we no longer can.
Return the final string after all such duplicate removals have been made.
It is guaranteed that the answer is unique.
- Sep 30, 2019...more
This is a problem from Leetcode - Get Equal Substrings Within Budget.
You are given two strings s and t of the same length. You want to change s to t. Changing the i-th character of s to i-th character of t costs |s[i] - t[i]| that is, the absolute difference between the ASCII values of the characters.
You are also given an integer maxCost.
Return the maximum length of a substring of s that can be changed to be the same as the corresponding substring of twith a cost less than or equal to maxCost.
If there is no substring from s that can be changed to its corresponding substring from t, return 0.
- Sep 29, 2019...more
This is a problem from Leetcode - Smallest String With Swaps.
You are given a string s, and an array of pairs of indices in the string pairs where pairs[i] = [a, b] indicates 2 indices(0-indexed) of the string.
You can swap the characters at any pair of indices in the given pairs any number of times.
Return the lexicographically smallest string that s can be changed to after using the swaps.