LeetCode Answers (1 to 50)

1 – Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Buy Me a Coffee? Your support is...

#5 Longest Palindromic Substring | LeetCode Answers (Python)

5. Longest Palindromic SubstringGiven a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Link to problem data-ad-client="ca-pub-3255865697013143" data-ad-slot="7759187902" data-ad-format="auto"...

#4 Median of Two Sorted Arrays | LeetCode Answers (Python)

4. Median of Two Sorted ArraysThere are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).You may assume nums1 and nums2 cannot be both empty.Link to problem...

#2 Add Two Numbers | LeetCode Answers (Python)

2. Add Two NumbersYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.You may assume the two numbers...