In this episode, we solve Cracking the Coding Interview Problem #1.6: String Compression, where we are given a strings and asked to return the compressed version where each element of the string is returned with the number of times it occurs. We solve this in O(n) linear runtime using Pointers.
Watch and enjoy.
My Other Channel: / @disrupted572
Top Software/ Coding Channels:
/ @csdojo
/ kevinnaughtonjr
/ @jomatech
/ @techlead
Top Python Coding Channels:
/ @neetcode
/ @timc3406
Twitter: / realchrisibe
Instagram: / christopher_ibe
Facebook: / christopher.ibeekeocha
Snapchat: @christopheribe
LinkedIn: / christopher-ibe-ekeocha
Problem Statement:
String Compression: Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabbcccccaaa would become a2b1c5a3. If the compressed string should not become smaller than the original string, your method should return the original string. You can assume the string has only uppercase and lowercase letters (a-z)
Hint: Do the easy thing first, compress the string, then compare the lengths. BE careful that you aren’t concatenating strings together. This can be very inefficient
Amazon Link: https://www.amazon.com/Cracking-Codin...
In questa pagina del sito puoi guardare il video online String Compression: Google & Palantir Problem {Using Pointers} della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Chris Ibe 04 ottobre 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 38 volte e gli è piaciuto 3 spettatori. Buona visione!