5. Longest Palindromic Substring Leetcode Solution in JavaScript (JS)

0 Problem: Given a string s, return the longest  palindromic substring in s. Example 1: Input: s = “babad” Output: “bab” Explanation: “aba” is also a valid answer. Example 2: Input: s = “cbbd” Output: “bb” Constraints: Solution: Simple solution for beginners with separate function to check palindrome and code to create all possible substrings from a string. Aadi … Read more

4. Median of Two Sorted Arrays Leetcode Solution in JavaScript (JS)

0 Problem: Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: Input: nums1 = [1,3], nums2 = [2] Output: 2.00000 Explanation: merged array = [1,2,3] and median is 2. Example 2: Input: nums1 = [1,2], nums2 = [3,4] Output: 2.50000 Explanation: merged array … Read more

3. Longest Substring Without Repeating Characters Leetcode solution in JavaScript (JS)

0 Problem: Given a string s, find the length of the longest  substring without repeating characters. Example 1: Input: s = “abcabcbb” Output: 3 Explanation: The answer is “abc”, with the length of 3. Example 2: Input: s = “bbbbb” Output: 1 Explanation: The answer is “b”, with the length of 1. Example 3: Input: s = “pwwkew” … Read more

2. Add Two Numbers Leetcode solution in JavaScript (JS)

0 Problem: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. Example … Read more

31. Next Permutation Leetcode solution in JavaScript (js)

0 Problem A permutation of an array of integers is an arrangement of its members into a sequence or linear order. The next permutation of an array of integers is the next lexicographically greater permutation of its integer. More formally, if all the permutations of the array are sorted in one container according to their lexicographical order, then the next … Read more

1. Two Sum Leetcode Problem Solution in JavaScript (js)

0 Problem Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] … Read more

Vlogging as a freelancing career?

0 Vlogging, or video blogging, can be a fulfilling and lucrative career for those who are passionate about creating and sharing video content. As a vlogger, you can create content on a wide range of topics, from personal experiences and stories to news and current events to product reviews and tutorials. To get started as … Read more

MySQL cheat sheet | Brief Summery of MySQL

0 Here is a MySQL cheat sheet that includes almost everything you would want to know about using MySQL: MySQL Commands MySQL Data Types MySQL Statements MySQL Operators MySQL Queries with examples SELECT This statement retrieves data from the specified table. The * wildcard can be used to select all columns. For example: INSERT INTO … Read more

How to center a div using CSS?

0 To center a div element using CSS, you can use the margin: auto and width properties. Here is an example: You can also use the text-align property to center the contents of the div. Here is an example: If you want to center the div vertically as well, you can use the position, top, … Read more

Skip to content