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 PrimeFactors { | |
| 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
    
  
  
    
  | /** | |
| * Define an array to be a railroad-tie array if the following three conditions hold | |
| * a. The array contains at least one non-zero element | |
| * b. Every non-zero element has exactly one non-zero neighbor | |
| * c. Every zero element has two non-zero neighbors. | |
| * | |
| * | |
| * For example, {1, 2, 0, 3, -18, 0, 2, 2} is a railroad-tie array because | |
| * a[0] = 1 has exactly one non-zero neighbor (a[1]) | |
| * a[1] = 2 has exactly one non-zero neighbor (a[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
    
  
  
    
  | /** | |
| * Calculate an array of 5 floats and calculate their sum. | |
| */ | |
| package com.hawa.practice; | |
| import lombok.extern.slf4j.Slf4j; | |
| @Slf4j | |
| public class PracticeSetOne { | 
  
    
      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
    
  
  
    
  | /** | |
| * Write a program to find out whether a given integer is present in an array or not. | |
| **/ | |
| package com.hawa.practice; | |
| import lombok.extern.slf4j.Slf4j; | |
| @Slf4j | |
| public class PracticeSetTwo { | 
  
    
      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
    
  
  
    
  | /** | |
| * The number 198 has the property that 198 = 11 + 99 + 88, i.e., if each of its digits is concatenated twice and then summed, the result | |
| * will be the original number. It turns out that 198 is the only number with this property. | |
| * <p> | |
| * However, the property can be generalized so that each digit is concatenated n times and then summed. | |
| * For example, 2997 = 222+999+999+777 and here each digit is concatenated | |
| * three times. | |
| * <p> | |
| * Write a function named checkContenatedSum that tests if a number has this generalized property. | |
| * <p> | 
  
    
      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 m-n sequenced array to be an array that contains one or more occurrences of all the integers between m and n inclusive. | |
| * | |
| * Furthermore, the array must be in ascending order and contain only those integers. For example, {2, 2, 3, 4, 4, 4, 5} is a 2-5 sequenced | |
| * array. | |
| * | |
| * The array {2, 2, 3, 5, 5, 5} is not a 2-5 sequenced array because it is missing a 4. The array {0, 2, 2, 3, 3} is not a 2-3 sequenced | |
| * array because the 0 is out of range. And {1,1, 3, 2, 2, 4} is not a 1-4 sequenced array because it is not in ascending order. | |
| * | |
| * Write a method named isSequencedArray that returns 1 if its argument is a m-n sequenced array, otherwise it returns 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
    
  
  
    
  | package com.hawa.practice; | |
| import lombok.extern.slf4j.Slf4j; | |
| @Slf4j | |
| public class FactorsOfNumber { | |
| public static void main(String[] args) { | |
| int num = 10; | |
| log.info("The factors of {} are {}", num, getFactorsOfNumber(num)); | |
| } | 
  
    
      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 the n-based integer rounding of an integer k to be the nearest multiple of n to k. If two multiples of n are equidistant use the greater one. | |
| * | |
| * For example | |
| * the 4-based rounding of 5 is 4 because 5 is closer to 4 than it is to 8, | |
| * the 5-based rounding of 5 is 5 because 5 is closer to 5 that it is to 10, | |
| * the 4-based rounding of 6 is 8 because 6 is equidistant from 4 and 8, so the greater one is used, | |
| * the 13-based rounding of 9 is 13, because 9 is closer to 13 than it is to 0, | |
| * Write a function named doIntegerBasedRounding that takes an integer array and rounds all its positive elements using n-based | |
| * integer rounding. | 
  
    
      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 is called digit-increasing if it is equal to n + nn + nnn + ... for some digit n between 1 and 9. For example 24 is digit- | |
| * increasing because it equals 2 + 22 (here n = 2) | |
| * | |
| * Write a function called isDigitIncreasing that returns 1 if its argument is digit-increasing otherwise, it returns 0. | |
| * | |
| * if n is then function returns reason | |
| * 7 1 because 7 = 7 (here n is 7) | |
| * 36 1 because 36 = 3 + 33 | |
| * 984 1 because 984 = 8 + 88 + 888 |