[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

Daily Coding Problem: Problem #1707 [Medium]

Monday, March 3, 2025

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Facebook. In chess, the Elo rating system is used to calculate player strengths based on

Simplification Takes Courage & Perplexity introduces Comet

Monday, March 3, 2025

Elicit raises $22M Series A, Perplexity is working on an AI-powered browser, developing taste, and more in this week's issue of Creativerly. Creativerly Simplification Takes Courage &

Mapped | Which Countries Are Perceived as the Most Corrupt? 🌎

Monday, March 3, 2025

In this map, we visualize the Corruption Perceptions Index Score for countries around the world. View Online | Subscribe | Download Our App Presented by: Stay current on the latest money news that

The new tablet to beat

Monday, March 3, 2025

5 top MWC products; iPhone 16e hands-on📱; Solar-powered laptop -- ZDNET ZDNET Tech Today - US March 3, 2025 TCL Nxtpaper 11 tablet at CES The tablet that replaced my Kindle and iPad is finally getting

Import AI 402: Why NVIDIA beats AMD: vending machines vs superintelligence; harder BIG-Bench

Monday, March 3, 2025

What will machines name their first discoveries? ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

GCP Newsletter #440

Monday, March 3, 2025

Welcome to issue #440 March 3rd, 2025 News LLM Official Blog Vertex AI Evaluate gen AI models with Vertex AI evaluation service and LLM comparator - Vertex AI evaluation service and LLM Comparator are

Apple Should Swap Out Siri with ChatGPT

Monday, March 3, 2025

Not forever, but for now. Until a new, better Siri is actually ready to roll — which may be *years* away... Apple Should Swap Out Siri with ChatGPT Not forever, but for now. Until a new, better Siri is

⚡ THN Weekly Recap: Alerts on Zero-Day Exploits, AI Breaches, and Crypto Heists

Monday, March 3, 2025

Get exclusive insights on cyber attacks—including expert analysis on zero-day exploits, AI breaches, and crypto hacks—in our free newsletter. ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌

⚙️ AI price war

Monday, March 3, 2025

Plus: The reality of LLM 'research' ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Post from Syncfusion Blogs on 03/03/2025

Monday, March 3, 2025

New blogs from Syncfusion ® AI-Driven Natural Language Filtering in WPF DataGrid for Smarter Data Processing By Susmitha Sundar This blog explains how to add AI-driven natural language filtering in the