Skip to main content

Strings

2 lessonsAbout 12 minutesBeginner

This part of the DSA Tutorial runs from Strings in JavaScript for DSA through to Common String Problems. There are 2 lessons here, and working through them takes about 12 minutes at a steady pace.

It follows on from Arrays, so finish that first if you have not already — the examples below assume you are comfortable with it.

Each lesson below says what it covers before you open it. Read them in order the first time; afterwards this page works as a index you can jump back into when you need to check one thing.

  1. 1Strings in JavaScript for DSAJavaScript strings are immutable, which makes building them in a loop quadratic. Learn the real cost of string operations and how to build and compare them efficiently.
  2. 2Common String ProblemsPalindromes, anagrams, reversal and first unique character — the string problems asked most often, each solved in JavaScript with its time and space cost.