Objective In this challenge, we're going to use loops to help us do some simple math. Task Given an integer,  , print its first   multiples. Each multiple   (where  ) should be printed on a new line in the form:  N x i = result . Input Format A single integer,  . Constraints Output Format Print   lines of output; each line   (where  ) contains the   of   in the form: N x i = result . Sample Input 2 Sample Output 2 x 1 = 2 2 x 2 = 4 2 x 3 = 6 2 x 4 = 8 2 x 5 = 10 2 x 6 = 12 2 x 7 = 14 2 x 8 = 16 2 x 9 = 18 2 x 10 = 20 Explanation:           Here, we just need to use for loops to achieve the result Solution : import  java.io.* ;  import  java.math.* ;  import  java.security.* ;  import  java.text.* ;  import  java.util.* ;  import  java.util.concurrent.* ;  import  java.util.regex.* ;     public  class  Solution  {      public  static  void  main ( String []  args )  t...
Dynamic Programming:Bottomup Approach| Program to find Fibonaaci number in that postion using Bottomup Approach
Idea Behind BottomUp Approach:
     In this approach,we find out the solution by divide into several sub problems and come up with a original solution from the small chunks.
Logic:
Code Logic:
Program:
         Declare a empty array with given size
Find the solution from the base case
Find the solution from the base case
Code Logic:
- Input the position to fibo number.
 - Declare the fun namely fibBottomup
 - base case n==1 or n==2 return 1
 - declare bot_up=[]*n times
 - set bot 1st and 2nd position from base value
 - Iterate from 3 pos to n+1
 - bot_up[n]=bot_up[1]+bot_up[2] position
 - return the result
 
Comments
Post a Comment