This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hawa.practice; | |
import lombok.extern.slf4j.Slf4j; | |
import java.util.HashSet; | |
import java.util.Iterator; | |
import java.util.Set; | |
@Slf4j | |
public class Trivalent { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hawa.practice; | |
import lombok.extern.slf4j.Slf4j; | |
@Slf4j | |
public class IsolatedNumber { | |
public static void main(String[] args) { | |
long number = 63; | |
log.info("Checking if given number {} is isolated or not. " + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hawa.practice; | |
import lombok.extern.slf4j.Slf4j; | |
@Slf4j | |
public class SequentiallyBounded { | |
public static void main(String[] args) { | |
// int[] arrayOfNumbers = {1, 2, 3, 3, 3, 99, 99, 99, 99}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hawa.practice; | |
import lombok.extern.slf4j.Slf4j; | |
@Slf4j | |
public class StackedNumber { | |
public static void main(String[] args) { | |
int number = 7; | |
log.info("Checking if given number {} is stacked or not. " + | |
"--> Result: 1 for yes and 0 for no.", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hawa.practice; | |
import lombok.extern.slf4j.Slf4j; | |
import java.util.ArrayList; | |
@Slf4j | |
public class SumSafe { | |
public static void main(String[] args) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hawa.practice; | |
import lombok.extern.slf4j.Slf4j; | |
@Slf4j | |
public class MadhavArray { | |
public static void main(String[] args) { | |
// int[] arrayOfNumbers = {2, 1, 1, 4, -1, -1}; | |
// int[] arrayOfNumbers = {6, 2, 4, 2, 2, 2, 1, 5, 0, 0}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A number n>0 is called cube-powerful if it is equal to the sum of the cubes of its digits. | |
* Write a function named isCubePowerful that returns 1 if its argument is cube-powerful; otherwise it returns 0. | |
* The function prototype is | |
* int isCubePowerful(int n); | |
* Hint: use modulo 10 arithmetic to get the digits of the number. | |
*/ | |
package com.hawa.practice; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Define an array to be a 121 array if all its elements are either 1 or 2 and it begins with one or more 1s followed by a one or more 2s | |
* and then ends with the same number of 1s that it begins with. Write a method named is121Array that returns 1 if its array argument is | |
* a 121 array, otherwise, it returns 0. | |
*/ | |
package com.hawa.practice; | |
import lombok.extern.slf4j.Slf4j; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* It is a fact that there exist two numbers x and y such that x! + y! = 10!. | |
* Write a method named solve10 that returns the values x and y in an array. | |
* The notation n! is called n factorial and is equal to n * n-1 * n-2 * … 2 * 1, e.g., 5! = 5*4*3*2*1 = 120. | |
* | |
*/ | |
package com.hawa.practice; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hawa.practice; | |
import lombok.extern.slf4j.Slf4j; | |
import java.util.ArrayList; | |
@Slf4j | |
public class PrimeCount { | |