Verification: a143cc29221c9be0

Php check if time is all i have

C++

#include

using namespace std;

int count(string a, string b, int m, int n)

{

    if ((m == 0 && n == 0) || n == 0)

        return 1;

    if (m == 0)

        return 0;

    if (a[m - 1] == b[n - 1])

        return count(a, b, m - 1, n - 1) +

               count(a, b, m - 1, n);

    else

        return count(a, b, m - 1, n);

}

int main()

{

    string a = "GeeksforGeeks";

    string b = "Gks";

    cout

    return 0;

}

Java

import java.io.*;

class GFG

{

    static int count(String a, String b, int m, int n)

    {

        if ((m == 0 && n == 0) || n == 0)

            return 1;

        if (m == 0)

            return 0;

        if (a.charAt(m - 1) == b.charAt(n - 1))

            return count(a, b, m - 1, n - 1) +

                   count(a, b, m - 1, n);

        else

            return count(a, b, m - 1, n);

    }

    public static void main (String[] args)

    {

        String a = "GeeksforGeeks";

        String b = "Gks";

        System.out.println( count(a, b, a.length(), b.length())) ;

    }

}

Python 3

def count(a, b, m, n):

    if ((m == 0 and n == 0) or n == 0):

        return 1

    if (m == 0):

        return 0

    if (a[m - 1] == b[n - 1]):

        return (count(a, b, m - 1, n - 1) +

                count(a, b, m - 1, n))

    else:

        return count(a, b, m - 1, n)

a = "GeeksforGeeks"

b = "Gks"

print(count(a, b, len(a),len(b)))

C#

using System;

class GFG

{

    static int count(string a, string b, int m, int n)

    {

        if ((m == 0 && n == 0) || n == 0)

            return 1;

        if (m == 0)

            return 0;

        if (a[m - 1] == b[n - 1])

            return count(a, b, m - 1, n - 1) +

                   count(a, b, m - 1, n);

        else

            return count(a, b, m - 1, n);

    }

    public static void Main ()

    {

        string a = "GeeksforGeeks";

        string b = "Gks";

        Console.Write( count(a, b, a.Length, b.Length) );

    }

}

PHP

function count_1($a, $b, $m, $n)

{

    if (($m == 0 && $n == 0) || $n == 0)

        return 1;

    if ($m == 0)

        return 0;

    if ($a[$m - 1] == $b[$n - 1])

        return count_1($a, $b, $m - 1, $n - 1) +

               count_1($a, $b, $m - 1, $n);

    else

        return count_1($a, $b, $m - 1, $n);

}

$a = "GeeksforGeeks";

$b = "Gks";

echo count_1($a, $b, strlen($a), strlen($b)) ."\n";

return 0;

?>

Javascript

    function count( a,  b , m , n)

    {

        if ((m == 0 && n == 0) || n == 0)

            return 1;

        if (m == 0)

            return 0;

        if (a[m - 1] == b[n - 1])

            return count(a, b, m - 1, n - 1) + count(a, b, m - 1, n);

        else

            return count(a, b, m - 1, n);

    }

    var a = "GeeksforGeeks";

    var b = "Gks";

    document.write(count(a, b, a.length, b.length));

C++

#include

using namespace std;

int count(string a, string b)

{

    int m = a.length();

    int n = b.length();

    int lookup[m + 1][n + 1] = { { 0 } };

    for (int i = 0; i

        lookup[0][i] = 0;

    for (int i = 0; i

        lookup[i][0] = 1;

    for (int i = 1; i

    {

        for (int j = 1; j

        {

            if (a[i - 1] == b[j - 1])

                lookup[i][j] = lookup[i - 1][j - 1] +

                               lookup[i - 1][j];

            else

                lookup[i][j] = lookup[i - 1][j];

        }

    }

    return lookup[m][n];

}

int main()

{

    string a = "GeeksforGeeks";

    string b = "Gks";

    cout

    return 0;

}

Java

import java.io.*;

class GFG

{

static int count(String a, String b)

{

    int m = a.length();

    int n = b.length();

    int lookup[][] = new int[m + 1][n + 1];

    for (int i = 0; i

        lookup[0][i] = 0;

    for (int i = 0; i

        lookup[i][0] = 1;

    for (int i = 1; i

    {

        for (int j = 1; j

        {

            if (a.charAt(i - 1) == b.charAt(j - 1))

                lookup[i][j] = lookup[i - 1][j - 1] +

                               lookup[i - 1][j];

            else

                lookup[i][j] = lookup[i - 1][j];

        }

    }

    return lookup[m][n];

}

public static void main (String[] args)

{

    String a = "GeeksforGeeks";

    String b = "Gks";

    System.out.println(count(a, b));

}

}

Python3

def count(a, b):

    m = len(a)

    n = len(b)

    lookup = [[0] * (n + 1) for i in range(m + 1)]

    for i in range(n+1):

        lookup[0][i] = 0

    for i in range(m + 1):

        lookup[i][0] = 1

    for i in range(1, m + 1):

        for j in range(1, n + 1):

            if a[i - 1] == b[j - 1]:

                lookup[i][j] = lookup[i - 1][j - 1] + lookup[i - 1][j]

            else:

                lookup[i][j] = lookup[i - 1][j]

    return lookup[m][n]

if __name__ == '__main__':

    a = "GeeksforGeeks"

    b = "Gks"

    print(count(a, b))

C#

using System;

class GFG

{

static int count(String a, String b)

{

    int m = a.Length;

    int n = b.Length;

    int[,] lookup = new int[m + 1, n + 1];

    for (int i = 0; i

        lookup[0, i] = 0;

    for (int i = 0; i

        lookup[i, 0] = 1;

    for (int i = 1; i

    {

        for (int j = 1; j

        {

            if (a[i - 1] == b[j - 1])

                lookup[i, j] = lookup[i - 1, j - 1] +

                            lookup[i - 1, j];

            else

                lookup[i, j] = lookup[i - 1, j];

        }

    }

    return lookup[m, n];

}

public static void Main()

{

    String a = "GeeksforGeeks";

    String b = "Gks";

    Console.WriteLine(count(a, b));

}

}

PHP

function count1($a, $b)

{

    $m = strlen($a);

    $n = strlen($b);

    $lookup = array_fill(0, $m + 1, array_fill(0, $n + 1, 0));

    for ($i = 0; $i $m; ++$i)

        $lookup[$i][0] = 1;

    for ($i = 1; $i $m; $i++)

    {

        for ($j = 1; $j $n; $j++)

        {

            if ($a[$i - 1] == $b[$j - 1])

                $lookup[$i][$j] = $lookup[$i - 1][$j - 1] +

                            $lookup[$i - 1][$j];

            else

                $lookup[$i][$j] = $lookup[$i - 1][$j];

        }

    }

    return $lookup[$m][$n];

}

    $a = "GeeksforGeeks";

    $b = "Gks";

    echo count1($a, $b);

?>

C++

#include

using namespace std;

bool isPrime(int n)

{

    if (n return false;

    for (int i=2; i

        if (n%i == 0)

            return false;

    return true;

}

int main()

{

    isPrime(11)?  cout " true\n": cout " false\n";

    isPrime(15)?  cout " true\n": cout " false\n";

    return 0;

}

Java

class GFG {

    static boolean isPrime(int n)

    {

        if (n 1) return false;

        for (int i = 2; i

            if (n % i == 0)

                return false;

        return true;

    }

    public static void main(String args[])

    {

        if(isPrime(11))

            System.out.println(" true");

        else

            System.out.println(" false");

        if(isPrime(15))

            System.out.println(" true");

        else

            System.out.println(" false");

    }

}

Python3

def isPrime(n):

    if n = 1:

        return False

    for i in range(2, n):

        if n % i == 0:

            return False;

    return True

print("true") if isPrime(11) else print("false")

print("true") if isPrime(14) else print("false")

C#

using System;

namespace prime

{

    public class GFG

    {    

        public static bool isprime(int n)

        {

            if (n return false;

            for (int i = 2; i

                if (n % i == 0)

                return false;

            return true;

        }

        public static void Main()

        {

            if (isprime(11)) Console.WriteLine("true");

            else Console.WriteLine("false");

            if (isprime(15)) Console.WriteLine("true");

            else Console.WriteLine("false");

        }

    }

}

PHP

function isPrime($n)

{

    if ($n return false;

    for ($i = 2; $i $n; $i++)

        if ($n % $i == 0)

            return false;

    return true;

}

$tet = isPrime(11) ? " true\n" :

                     " false\n";

echo $tet;

$tet = isPrime(15) ? " true\n" :

                     " false\n";

echo $tet;

?>

C++

#include

#include

using namespace std;

bool isPerfectSquare(int x)

{

    int s = sqrt(x);

    return (s*s == x);

}

bool isFibonacci(int n)

{

    return isPerfectSquare(5*n*n + 4) ||

           isPerfectSquare(5*n*n - 4);

}

int main()

{

  for (int i = 1; i

     isFibonacci(i)? cout " is a Fibonacci Number \n":

                     cout " is a not Fibonacci Number \n" ;

  return 0;

}

Java

class GFG

{

    static  boolean isPerfectSquare(int x)

    {

        int s = (int) Math.sqrt(x);

        return (s*s == x);

    }

    static boolean isFibonacci(int n)

    {

        return isPerfectSquare(5*n*n + 4) ||

               isPerfectSquare(5*n*n - 4);

    }

    public static void main(String[] args)

    {

        for (int i = 1; i 10; i++)

             System.out.println(isFibonacci(i) ?  i +  " is a Fibonacci Number" :

                                                  i + " is a not Fibonacci Number");

    }

}

Python

import math

def isPerfectSquare(x):

    s = int(math.sqrt(x))

    return s*s == x

def isFibonacci(n):

    return isPerfectSquare(5*n*n + 4) or isPerfectSquare(5*n*n - 4)

for i in range(1,11):

     if (isFibonacci(i) == True):

         print i,"is a Fibonacci Number"

     else:

         print i,"is a not Fibonacci Number "

C#

using System;

class GFG {

    static bool isPerfectSquare(int x)

    {

        int s = (int)Math.Sqrt(x);

        return (s * s == x);

    }

    static bool isFibonacci(int n)

    {

        return isPerfectSquare(5 * n * n + 4) ||

               isPerfectSquare(5 * n * n - 4);

    }

    public static void Main()

    {

        for (int i = 1; i

            Console.WriteLine(isFibonacci(i) ? i +

                              " is a Fibonacci Number" : i +

                              " is a not Fibonacci Number");

    }

}

PHP

function isPerfectSquare($x)

{

    $s = (int)(sqrt($x));

    return ($s * $s == $x);

}

function isFibonacci($n)

{

    return isPerfectSquare(5 * $n * $n + 4) ||

           isPerfectSquare(5 * $n * $n - 4);

}

for ($i = 1; $i $i++)

if(isFibonacci($i))

echo "$i is a Fibonacci Number \n";

else

echo "$i is a not Fibonacci Number \n" ;

?>