How I Became LeetCode’s First JavaScript and TypeScript Content Creator!

Grigor Grantovich Sargsyan
4 min readMay 21, 2023

--

On March 3rd, LeetCode made a special announcement on their General Discussion forum. 🎁 Limited Time Challenge for Javascript Experts!

The announcement read:

Are you a JavaScript expert looking to make a difference in the global developer community?

We have an exciting challenge for you that will not only help fellow developers but also give you a chance to win some amazing prizes! Participate in the challenge by sharing frontend interview questions with LeetCode.

For a while now I had been coding primarily in TypeScript at Intuit and I thought that this would be a fun challenge. The competition only asked contestants to submit two problems in the form of a LeetCode playground with test-cases and a brief description of the problem. I remember a friend telling me about a question he was asked in a frontend interview at Google where he was asked to implement JSON.stringify() and I decided to submit that as my first question. The next was an easier problem I found in a youtube video which was to implement Array.flat(). Both of my LeetCode playgrounds can be found here:

Implement JSON stringify
Implement Array.flat()

On March 6th, I submitted both and waited hoping to be chosen as one of the winners. The post said that the top 3 users will receive LeetCode Backpack and LeetCode Premium. It also said that winners will have a chance to work with LeetCode on an exciting and impactful project.

I honestly only wanted the backpack. On March 9th, I got an email from the head of Talent at LeetCode thanking me for the submission and asking for my availability. After exchanging a few emails, we spoke on the phone. She told me that LeetCode was about to start a project to write problems that were entirely focused on frontend and that the COO needed content creators that were experts in JavaScript and TypeScript. I wouldn’t call myself an expert, but I wasn’t about to pass up on this opportunity to write questions for a platform that I had spent days of my life solving their problems.

Almost every software engineer at some point in their career has found themselves on LeetCode and I was excited to give back to the LeetCoding community in a meaningful way. I had personally noticed that less companies were conducting general coding interviews and instead were splitting positions into frontend and backend. Backend interviews still feel much like the original general coding interviews many of us engineers were used to, but the frontend interviews had this Wild West feel to them. These interviews could vary wildly from focusing specifically on JavaScript concepts like Promises and Closures to writing html and making fetch requests. The breath of possible questions was dizzyingly wide and consistency was needed. LeetCode, being the largest platform for solving coding problems, had the power to influence that interview process by putting forward a standard set of frontend coding questions that other engineers could practice and potentially reference when conducting their own frontend coding interviews.

I met the COO and soon after I met another winner of the contest. We were tasked with putting together a list of questions and planing the timeline of the project. We collaborated, prototyped, and wrote the problems that would become the first frontend challenges to be released on LeetCode with support for JavaScript and TypeScript. Along the way I also expanded my knowledge of JavaScript and TypeScript specifically to build these problems. It was a blast and after a few weeks we had more people get involved with the project to help with the rollout. Unfortunately, I couldn’t dedicate the same amount of time my teammates were dedicating and decided to walk away from the project to focus on things in my personal life.

LeetCode’s announcment of Javascript problems

I knew the project was in good hands and was confident that they would build on the base that I created. At the time of writing this article, LeetCode is currently on Day 17 of a 30 Day JavaScript Challenge and I’m happy to see many other problems that I proposed made it into the challenge. The LeetCode team also announced a new category of problems entirely dedicated to JavaScript found here. What’s truly impressed me is the speed at which the LeetCode community collaborates to create the most unique and efficient ways of solving these problems in ways that I hadn’t even thought of. Seeing my original 40 line JSON.stringify solution being reduced to just 5 clean lines of code by the community was a humbling experience.

function jsonStringify(object: any): string {
if (typeof object === 'number' || typeof object === 'boolean' || object === undefined) return object;

if (object === null) return 'null';

if (typeof object === 'string') return `"${object}"`;

if (Array.isArray(object)) return `[${object.map(jsonStringify).join(',')}]`;

return '{' + Object.keys(object).map(key => `"${key}":${jsonStringify(object[key])}`) + '}';
};

Thanks for reading and happy coding!

--

--

Grigor Grantovich Sargsyan

Software Engineering | Data Science | Economics | Storytelling | World History | MMA