[interviewDojo] #10: Alternate string characters

Hi,

Solving this problem on Strings will let you practice some important data structures and patterns that we have encountered so far.
If you need a refresher, review the String Boot Camp and Trees Boot Camp articles before attempting this problem.

Problem

Given a string, return a string with the same characters but re-arranged in such a way that there are no adjacent characters that are the same. If it’s not possible, return null.

Example:

Input: "bbaaac"
Output: "ababac"

Input: "baaa"
Output: null


Solution
After practicing on your own, compare your code with the in-depth solution



Interview coming up? Get in touch if you need personal coaching to ace your interview or if you need to practice with mock interviews with experienced engineers who work at the Big 4 tech companies. 

Feel free to forward this email to a friend so that they can subscribe here to receive these emails.
 
Copyright © 2020 Interview Dojo, All rights reserved.
You are receiving this email because you opted in via our website.

No more? .

Email Marketing Powered by Mailchimp

Older messages

[interviewDojo] #9: Strings Boot Camp

Tuesday, April 21, 2020

Hi, Today we discuss some basic concepts and operations on Strings. Interview problems on Strings are extremely common, and because strings can be considered arrays of characters the same patterns

[interviewDojo] #7: Find the middle element of a linked list

Friday, April 17, 2020

Hi, Finding the middle element of a linked list is a simple problem that can be solved in linear time with a single pass of the list. Problem Given a linked list, find the middle element. Example:

[interviewDojo] #6: Linked Lists Boot Camp

Thursday, April 16, 2020

Hi, A linked list is a data structure that contains a sequence of nodes such that each node contains a value and a pointer to the next node. The first node is referred to as head and the last node is

[interviewDojo] #5: Find balanced string with minimum insertions and deletions

Tuesday, April 14, 2020

Hi, Today's practice problem is on strings. Problem Given a string of parenthesis, if the parenthesis are not balanced, then return the balanced string than can be produced with the minimum number

[interviewDojo] #4: Check if a tree is a Binary Search Tree

Sunday, April 12, 2020

Hi, Today's problem is a fundamental algorithm to practice traversing tree data structures. Problem Given a binary tree, write an efficient algorithm to validate that the tree is a Binary Search

You Might Also Like

Spyglass Dispatch: Comcast's SpinCo Out Hunting • NVIDIA Makes Mint • The Fate of Chrome • Amazon Shows New 'Show' • End of Around the Horn • Writing on the Web

Thursday, November 21, 2024

Comcast's SpinCo Out Hunting • NVIDIA Makes Mint • The Fate of Chrome • Amazon Shows New 'Show' • End of Around the Horn • Writing on the Web The Spyglass Dispatch is a free newsletter sent

Issue 340 - Elon Musk hints at a new model for large families

Thursday, November 21, 2024

View this email in your browser If you are just now finding out about Tesletter, you can subscribe here! If you already know Tesletter and want to support us, check out our Patreon page Issue 340 -

Data Science Weekly - Issue 574

Thursday, November 21, 2024

Curated news, articles and jobs related to Data Science, AI, & Machine Learning ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Programmer Weekly - Issue 232

Thursday, November 21, 2024

View this email in your browser Programmer Weekly Welcome to issue 232 of Programmer Weekly. Let's get straight to the links this week. Quote of the Week "Writing software is a very intense,

Better - An AI Powered Code Reviewer

Thursday, November 21, 2024

Top Tech Content sent at Noon! How the world collects web data Read this email in your browser How are you, @newsletterest1? 🪐 What's happening in tech today, November 21, 2024? The HackerNoon

Python Weekly - Issue 677

Thursday, November 21, 2024

View this email in your browser Python Weekly Welcome to issue 677 of Python Weekly. Let's get straight to the links this week. From Our Sponsor Get Your Weekly Dose of Programming A weekly

Web Tools #592 - JS Libraries, Git/CLI Tools, Media/SVG

Thursday, November 21, 2024

WEB VERSION Issue #592 • November 21, 2024 Advertisement Deploy AMD Instinct™ MI300X on Vultr AMD Instinct MI300X accelerators are now available on the Vultr cloud platform. With thousands of AMD

Stop Using the Wrong State Management in Jetpack Compose

Thursday, November 21, 2024

View in browser 🔖 Articles Benchmark Insights: Direct State Propagation vs. Lambda-based State in Jetpack Compose Here, we'll dive into some benchmark analysis on the state propagation approach in

wpmail.me issue#694

Thursday, November 21, 2024

wpMail.me wpmail.me issue#694 - The weekly WordPress newsletter. No spam, no nonsense. - November 21, 2024 Is this email not displaying correctly? View it in your browser. News & Articles State of

Turn off Google AI with two letters

Thursday, November 21, 2024

$250 off M4 MacBook; Linux Foundation marks 20 years; Bluesky tips -- ZDNET ZDNET Tech Today - US November 21, 2024 laptop This absurdly simple trick turns off AI in your Google Search results There