[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

Charted | The Carbon Footprint of Major Travel Methods 🌐

Friday, May 3, 2024

Transport accounts for nearly one-quarter of global energy-related CO2 emissions. This chart shows the carbon footprint of travel methods. View Online | Subscribe Presented by: Morningstar Discover the

Apple's AI Strategy, At Your Service

Friday, May 3, 2024

The relative calm before the "AI, AI, AI, AI, AI" storm... Apple's AI Strategy, At Your Service By MG Siegler • 3 May 2024 View in browser View in browser At one point during Apple's

5 gadgets I never fly without

Friday, May 3, 2024

How to save on internet; BYO AI; Gemini features we need; Prime Day 2024 -- ZDNET ZDNET Tech Today - US May 3, 2024 placeholder I fly 10 times a year. These 5 tech gadgets are lifesavers From recording

⚙️ Microsoft bans the police from using their AI

Friday, May 3, 2024

Plus: The first AI diplomat is here ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Weekend Read: Private and Medical AI 🕵️‍♀️

Friday, May 3, 2024

Don't accidentally train GPT-5 ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Microsoft thinks generative AI and faces shouldn’t mix

Friday, May 3, 2024

The company has banned its AI from being used for face recognition View this email online in your browser By Alex Wilhelm Friday, May 3, 2024 Welcome to TechCrunch AM! Today, we have notes on

Issue #539: Discord with Colyseus, parametric surface, and StrikeForce Kitty

Friday, May 3, 2024

Weekly newsletter about HTML5 Game Development. Is this email not displaying correctly? View it in your browser. Issue #539 - May 3rd 2024 If you have anything you want to share with the HTML5 game

Peloton's grim post-pandemic reality

Friday, May 3, 2024

The Morning After It's Friday, May 03, 2024. Peloton had a great pandemic. It's a weird thing to say, but the company's premium exercise equipment (expanding from bikes to treadmills and

Four Critical Vulnerabilities Expose HPE Aruba Devices to RCE Attacks

Friday, May 3, 2024

THN Daily Updates Newsletter cover Enterprise Transformation to AI and the Metaverse ($59.99 Value) FREE for a Limited Time Strategies for the Technology Revolution Download Now Sponsored LATEST NEWS

Post from Syncfusion Blogs on 05/03/2024

Friday, May 3, 2024

New blogs from Syncfusion Create Interactive Floor Planner Diagrams using Blazor Diagram Library By Keerthivasan R This blog explains how to create interactive floor planner diagrams using the