A string A is special if A = B + B (an empty string is also special)
example "aa", "aabbaabb" are special, but "aba", "aabb" are not.
Find smallest number of operations to change the given string into a special string
You are given a string 'S' to make it special you can do following operations:
Examples:
"aba" -> 1 // remove 'b' and string becomes "aa"
"a" -> 1 // either remove or add 'a'Constraints:
max string length = 100
string characters are [a-z]
A garden is a rectangular grid of squares. Some squares have roses.
We want to assign a gardner who will work on 'k' roses, he will work on a rectangural patch. We want to minimise the cost which is equal to perimeter of the rectangle gardner is working on.
Given two arrays X and Y coordinates of roses and an integer k. Find the min cost.
Constraints:
values of x and y are [0,100] inclusive
X, Y arrays max elements 100
Given a binary representation of a numberr in an array, convert it to base 6 and return the array.
Input : base 2 array
Output : base 6 array
Constraints:
base2 array length can be max 100
how to do this without using int128 or Big Integers?
Can anyone provide me working approaches for these questions!