Tags » Substring

Permutation in String

Given a pattern and a text. Determine whether a permutation of the pattern in the text.

“Two Pointers” Substring Framework Solution

This is the two pointers “Substring Framework” solution to this problem. 234 more words

(Java) alphabetic substring comparison ends up with a wrong result

In one of these HackerRank Java challenges, there is a problem which is defined as:

The problem

We define the following terms:

  • Lexicographical Order, also known as alphabetic or dictionary order, orders characters as follows: A < B < …< Y < Z < a < b…

457 more words

Minimum Window Substring

General Framework to Solve Substring Problems

Given a string and need to find a substring of it which satisfy some restrictions. A general way is to use a hashmap assisted with two pointers. 289 more words

Two Pointers

PHP-strpos function

The strpos function in PHP is used to determine whether a string is contained in another string.

For Example

If there is a string A that contains the following words “The cat is sleeping” and you have another string B that contains this “cat” 81 more words

Web Development


  1.  int a=10, b=8;

(i) a%b++

(ii) ++a-b–

(iii) a++ – b–

(iv) a– + b++


  1.  a% b= 10 % 8 = 2 (% is to find the remainder)
  2. 17 more words

Program for subString()

import java.util.Scanner;
public class Strings_SubString 
 public static String subString(String s , int start ,int end)
 char[] ch = s.toCharArray();
 String res = "";
 for (int i = start; i < end; i++) 
 res = res + ch[i];
 return res;
 public static void main(String[] args) 
 Scanner sc = new Scanner(System.in);
 System.out.println("Enter the String :- ");
 String s1 = sc.nextLine();
 System.out.println("Enter the starting index :- ");
 int a = sc.nextInt();
 System.out.println("Enter the ending index :- ");
 int b = sc.nextInt();

Getting a Substring in MySQL

I just learned how to get substring of specific range using LOCATE() and SUBSTRING().

Let’s say we have email addresses and want to get username part from them. 53 more words