This file contains 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
#include<iostream> | |
using namespace std; | |
int main(){ | |
int i,j,k,l,range; | |
cout<<"Enter Size of Range: "; | |
cin>>range; | |
cout<<"Range: "<<range<<endl; | |
for(i=1;i<=range;i++){ | |
for(j=1;j<=range-i;j++){ | |
cout<<" "; //spacing |
This file contains 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
#include<iostream> | |
using namespace std; | |
int main(){ | |
int i,j,k,l,range; | |
cout<<"Enter Size of Range: "; | |
cin>>range; | |
cout<<"Range: "<<range<<endl; | |
//first half code | |
for(i=1;i<=range;i++){ | |
for(j=1;j<=range-i;j++){ |
This file contains 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
class Solution { | |
public int[][] generateMatrix(int n) { | |
//int k=0; | |
// int m=mat.length; | |
//int n=mat[0].length; | |
int num=1; | |
int mat[][]=new int[n][n]; | |
This file contains 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 whatever; // don't place package name! */ | |
import java.util.*; | |
import java.lang.*; | |
import java.io.*; | |
/* Name of the class has to be "Main" only if the class is public. */ | |
class Ideone | |
{ | |
public static void main (String[] args) throws java.lang.Exception |
This file contains 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 whatever; // don't place package name! */ | |
import java.util.*; | |
import java.lang.*; | |
import java.io.*; | |
class Ideone | |
{ |
This file contains 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
Problem Description:- | |
There are N buildings in a row with different heights(H[i]). | |
You are viewing the buildings from the left and can see the roof of a building, if no building to the left of that building has height greater than equal to height of that building. | |
You are asked the number of buildings whose roofs you can see. | |
Input:- | |
The first line contains N denoting number of buildings. | |
The next line contains N space seperated integers denoting heights of the buildings from left to right. |
This file contains 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
Problem Description:- | |
There are N buildings in a row with different heights(H[i]). | |
You are viewing the buildings from the left and can see the roof of a building, if no building to the left of that building has height greater than equal to height of that building. | |
You are asked the number of buildings whose roofs you can see. | |
Input:- | |
The first line contains N denoting number of buildings. | |
The next line contains N space seperated integers denoting heights of the buildings from left to right. |
This file contains 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 whatever; // don't place package name! */ | |
import java.util.*; | |
import java.lang.*; | |
import java.io.*; | |
/* Name of the class has to be "Main" only if the class is public. */ | |
class Ideone | |
{ | |
public static void fib(int n){ |
This file contains 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 whatever; // don't place package name! */ | |
import java.util.*; | |
import java.lang.*; | |
import java.io.*; | |
class Ideone | |
{ |
This file contains 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 whatever; // don't place package name! */ | |
import java.util.*; | |
import java.lang.*; | |
import java.io.*; | |
/* Name of the class has to be "Main" only if the class is public. */ | |
class Ideone | |
{ | |
public static void main (String[] args) throws java.lang.Exception |