Implement strstr function in Java
Write an efficient algorithm to implement the strstr function in Java, which returns the index of the first occurrence of a string in another string.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedWrite an efficient algorithm to implement the strstr function in Java, which returns the index of the first occurrence of a string in another string.
Euclid’s algorithm (or Euclidean algorithm) is a method for efficiently finding the greatest common divisor (GCD) of two numbers. The GCD of two integers, X and Y, is the largest number that divides both X and Y without leaving a remainder.
The extended Euclidean algorithm is an extension to the Euclidean algorithm, which computes, besides the greatest common divisor of integers a and b, the coefficients of Bézout’s identity, i.e., integers x and y such that ax + by = gcd(a, b).
In this post, we will see how to reverse an array in C in linear time.
This post will discuss how to list all files in a directory and all its subdirectories in Java with Guava and Apache Commons IO library.
This post will discuss how to reverse a list in Java by modifying the list in-place. That means that the conversion should occur without using any auxiliary list by overwriting the existing elements of the specified list.
This post will discuss how to reverse an array in Java.
This post will discuss how to reverse a string in Java in 10 different ways. For example, the reverse of “Techie Delight” is “thgileD eihceT”.
In this post, we will show we how to reverse a string in Java using recursion.
Given an integer array, find all distinct increasing subsequences of length two or more.
Given an array of distinct positive integers, find the total number of distinct permutations that add up to a given target, where each array element may be used any number of times.
Given a binary tree, where each node stores a value between 0 and 9, calculate the sum of the numbers created by the paths from root to leaf.