forked from RyanFehr/HackerRank
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
26 lines (21 loc) · 786 Bytes
/
Solution.java
File metadata and controls
26 lines (21 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//Problem: https://www.hackerrank.com/challenges/staircase
//Java 8
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner input = new Scanner(System.in);
int n = input.nextInt();
StringBuilder stair = new StringBuilder("");
for(int i = 0; i < n; i++)
{
stair.append(" ");
}//Builds the a basic stair with no hashes
for(int i = 1; i< n+1; i++)
{
stair.setCharAt(n-i,'#');
System.out.println(stair);
}//Makes a longer step each iteration
}
}