Blogs Hub

by AskGif | Oct 17, 2020 | Category :coding

Number of Lines To Write String - String - Easy - LeetCode

Number of Lines To Write String - String - Easy - LeetCode

We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 100 units, it is written on the next line. We are given an array widths, an array where widths[0] is the width

read more...

by AskGif | Oct 17, 2020 | Category :coding

Rotate String - String - Easy - LeetCode

Rotate String - String - Easy - LeetCode

We are given two strings, A and B. A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example, if A = 'abcde', then it will be 'bcdea' after one shift on A. Return True if and only if A can become B after some number of shifts on A.</p

read more...

by AskGif | Oct 17, 2020 | Category :coding

License Key Formatting - String - Easy - LeetCode

License Key Formatting - String - Easy - LeetCode

You are given a license key represented as a string S which consists of only alphanumeric character and dashes. The string is separated into N+1 groups by N dashes. Given a number K, we would want to reformat the strings such that each group contains exactly K characters, except for the fi

read more...

by AskGif | Oct 02, 2020 | Category :coding

Rearrange Spaces Between Words - String - Easy - LeetCode

Rearrange Spaces Between Words - String - Easy - LeetCode

You are given a string text of words that are placed among some number of spaces. Each word consists of one or more lowercase English letters and are separated by at least one space. It's guaranteed that text contains at least one word. Rearrange the spaces so that there is an equal number

read more...

by AskGif | Oct 02, 2020 | Category :coding

Replace All ? to Avoid Consecutive Repeating Characters - String - Easy - LeetCode

Replace All ? to Avoid Consecutive Repeating Characters - String - Easy - LeetCode

Given a string s containing only lower case English letters and the '?' character, convert all the '?' characters into lower case letters such that the final string does not contain any consecutive repeating characters. You cannot modify the non '?' characters. It is guaranteed that there

read more...

by AskGif | Oct 02, 2020 | Category :coding

Thousand Separator - String - Easy - LeetCode

Thousand Separator - String - Easy - LeetCode

Given an integer n, add a dot (".") as the thousands separator and return it in string format. &nbsp; Example 1: Input: n = 987<br />Output: "987"<br />Example 2: Input: n = 1234<br />Output: "1.234"<br />Example 3: Input: n = 123456789<br />Output: "123.456.789

read more...

by AskGif | Oct 02, 2020 | Category :coding

Make The String Great - String - Easy - LeetCode

Make The String Great - String - Easy - LeetCode

Given a string s of lower and upper case English letters. A good string is a string which doesn't have two adjacent characters s[i] and s[i + 1] where: 0 &lt;= i &lt;= s.length - 2<br />s[i] is a lower-case letter and s[i + 1] is the same letter but in upper-case or vice-versa.<br /

read more...

by AskGif | Oct 02, 2020 | Category :coding

Reformat Date - String - Easy - LeetCode

Reformat Date - String - Easy - LeetCode

Given a date string in the form Day Month Year, where: Day is in the set {"1st", "2nd", "3rd", "4th", ..., "30th", "31st"}.<br />Month is in the set {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}.<br />Year is in the range [1900, 2100].<br />Convert th

read more...

by AskGif | Oct 02, 2020 | Category :coding

Path Crossing - String - Easy - LeetCode

Path Crossing - String - Easy - LeetCode

Given a string path, where path[i] = 'N', 'S', 'E' or 'W', each representing moving one unit north, south, east, or west, respectively. You start at the origin (0, 0) on a 2D plane and walk on the path specified by path. Return True if the path crosses itself at any point, that is, if at a

read more...

by AskGif | Jun 06, 2020 | Category :coding

Groups of Special-Equivalent Strings - Easy - LeetCode

Groups of Special-Equivalent Strings - Easy - LeetCode

You are given an array A of strings. A move onto S consists of swapping any two even indexed characters of S, or any two odd indexed characters of S. Two strings S and T are special-equivalent if after any number of moves onto S, S == T. For example, S = "zzxy" and T = "xy

read more...

by AskGif | Jun 05, 2020 | Category :coding

Roman to Integer - String - Easy - LeetCode

Roman to Integer - String - Easy - LeetCode

Roman numerals are represented by seven different symbols: I, V, X, L, C, D, and M. &nbsp; Symbol&nbsp; &nbsp; &nbsp; &nbsp;Value I&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 V&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5 X&nbsp; &nbsp; &nbsp; &nb

read more...

by AskGif | Jun 05, 2020 | Category :coding

Longest Common Prefix - String - Easy - LeetCode

Longest Common Prefix - String - Easy - LeetCode

Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". &nbsp; Example 1: Input: ["flower","flow","flight"] Output: "fl" &nbsp; Example 2: Input:

read more...