JAVA_CODINGS Telegram 81
61. Missing number in an array.

class MissingNumberArray
{
public static int count = 0;
public static int position = 0;
public static boolean flag = false;

public static void main(String[] args)
{
int a[] = {0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 20, 21, 23};

findMissingNumbers(a, position);
}

private static void findMissingNumbers(int a[], int position)
{
if (position == a.length - 1)
return;

for (; position < a[a.length - 1]; position++)
{
if ((a[position] - count) != position)
{
System.out.println("Missing Number: " + (position + count));
flag = true;
count++;
break;
}
}

if (flag)
{
flag = false;
findMissingNumbers(a, position);
}
}
}

@java_codings



tgoop.com/java_codings/81
Create:
Last Update:

61. Missing number in an array.

class MissingNumberArray
{
public static int count = 0;
public static int position = 0;
public static boolean flag = false;

public static void main(String[] args)
{
int a[] = {0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 20, 21, 23};

findMissingNumbers(a, position);
}

private static void findMissingNumbers(int a[], int position)
{
if (position == a.length - 1)
return;

for (; position < a[a.length - 1]; position++)
{
if ((a[position] - count) != position)
{
System.out.println("Missing Number: " + (position + count));
flag = true;
count++;
break;
}
}

if (flag)
{
flag = false;
findMissingNumbers(a, position);
}
}
}

@java_codings

BY Advance Java πŸ‘¨β€πŸ’»


Share with your friend now:
tgoop.com/java_codings/81

View MORE
Open in Telegram


Telegram News

Date: |

While some crypto traders move toward screaming as a coping mechanism, many mental health experts have argued that β€œscream therapy” is pseudoscience. Scientific research or no, it obviously feels good. The best encrypted messaging apps Read now Activate up to 20 bots How to Create a Private or Public Channel on Telegram?
from us


Telegram Advance Java πŸ‘¨β€πŸ’»
FROM American