Find the Longest Common Prefix using Python
The challenge
Write a function to find the longest common prefix string amongst an array of strings. This string manipulation challenge requires …
Read Article →In-depth guides, insights, and best practices for modern software engineering
Write a function to find the longest common prefix string amongst an array of strings. This string manipulation challenge requires …
Read Article →he count-and-say sequence is the sequence of integers with the first five terms as following:
1. 1 2. 11 3. 21 4. 1211 …Read Article →
Given a non-empty array of digits representing a non-negative integer, increment one to the integer. This challenge involves array …
Read Article →Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have …
Read Article →You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Note:
You have to rotate the image …
Read Article →Determine if a 9×9 Sudoku board is valid. Only the filled cells need to be validated according to the …
Read Article →Given two arrays, write a function to compute their intersection.
Example 1:
Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2,2] …Read Article →
Given an array, rotate the array to the right by k steps, where k is non-negative.
Example 1:
Input: nums = [1,2,3,4,5,6,7], k = 3 …Read Article →
Write a program that outputs the string representation of numbers from 1 to n.
But for multiples of three it should output “Fizz” …
Read Article →Python has a fantastic feature called slices. It allows you to work with a list, set or string by it’s index items.
E.g.:
string_sample = …
Read Article →
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 …
Read Article →Write a function:
def solution(A)
that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does …
Read Article →Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
Note: For the purpose of …
Read Article →Given two strings s and t , write a function to determine if t is an anagram of s.
Example 1:
Input: s = "anagram", t = "nagaram" …Read Article →
Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Example 1:
Input: …Read Article →
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The …
Read Article →Perhaps you have a screen-share session coming up and you want a nice clean desktop to show everyone. Also, nobody will …
Given a string, find the first non-repeating character in it and return its index. If it doesn’t exist, return -1.
Examples:
s = …Read Article →
What do you do when you create a new Maven Java project, and when you run it, you get the following error:
Error:java: error: release version 5 not …
I noticed an interesting thing with a certain visitor after posting a blog post to Facebook.
The IP address that the Facebook crawler uses to visit …
Read Article →Given a 32-bit signed integer, reverse digits of an integer.
Example 1:
Input: 123 Output: 321
Example 2:
Input: -123 Output: -321 …Read Article →
Write a function that reverses a string. The input string is given as an array of characters char[].
Do not allocate extra space for …
Read Article →Given an array of integers, find if the array contains any duplicates.
Your function should return true if any value appears at least …
Read Article →Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
Find all the …
Read Article →