Showing posts with label hackerrank solutions. Show all posts
Showing posts with label hackerrank solutions. Show all posts

Friday, March 5, 2021

Weather Observation Station 9 | Basic Select | SQL | HackerRank | Solution



Problem : https://www.hackerrank.com/challenges/weather-observation-station-9/problem

Solution :


/*

Enter your query here.

*/


SELECT DISTINCT CITY FROM STATION WHERE LEFT(CITY,1) NOT IN ('a','e','i','o','u');











Weather Observation Station 1 | Basic Select | SQL | HackerRank | Solution


Problem : https://www.hackerrank.com/challenges/weather-observation-station-1/problem

Solution : 

/*

Enter your query here.

*/


SELECT CITY , STATE FROM STATION;

























Japanese Cities' Attributes | Basic Select | SQL | Hackerrank | Solution


Problem : https://www.hackerrank.com/challenges/japanese-cities-attributes/problem

Solution : 


SELECT * FROM CITY WHERE COUNTRYCODE="JPN";











Friday, January 1, 2021

Conditional Statements | HackerRank | C++ | Solution | color the code



Problem : https://www.hackerrank.com/challenges/c-tutorial-conditional-if-else/problem

Solution : 

#include <bits/stdc++.h>


using namespace std;



int main()
{
    int n;
    cin >> n;
    cin.ignore(numeric_limits<streamsize>::max(), '\n');

    // Write Your Code Here
    if(n == 1){
        cout<<"one";
    }else if(n == 2){
        cout<<"two";
    }else if(n == 3){
        cout<<"three";
    }else if(n == 4){
        cout<<"four";
    }else if(n == 5){
        cout<<"five";
    }else if(n == 6){
        cout<<"six";
    }else if(n == 7){
        cout<<"seven";
    }else if(n == 8){
        cout<<"eight";
    }else if(n == 9){
        cout<<"nine";
    }else{
        cout<<"Greater than 9";
    }
    
    return 0;
}

Wednesday, December 30, 2020

Java Stdin and Stdout I HackerRank | JAVA | Solution | Easy | Color The Code



Problem : https://www.hackerrank.com/challenges/java-stdin-and-stdout-1/problem

Solution : import java.util.*;


public class Solution {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        // Complete this line
        int b = scan.nextInt();
        // Complete this line
        int c = scan.nextInt();
        
        System.out.println(a);
        // Complete this line
        System.out.println(b);
        // Complete this line
        System.out.println(c);
        
        scan.close();
    }
}

Welcome to Java! | HackerRank | Java | Easy | Solution



Problem : https://www.hackerrank.com/challenges/welcome-to-java/problem

Solution : public class Solution {


    public static void main(String[] args) {
        /* Enter your code here. Print output to STDOUT. Your class should be named Solution. */
        System.out.println("Hello, World.");
        System.out.println("Hello, Java.");
    }
}


Monday, December 28, 2020

Arrays Introduction | Hackerrank | C++ | Easy | Solution

Problem : https://www.hackerrank.com/challenges/arrays-introduction/problem

 Solution : 

#include <cmath>

#include <cstdio>

#include <vector>

#include <iostream>

#include <algorithm>

using namespace std;


void reverse(int A[],int size){

    for(int i = size -1 ;i>=0;i--){

        cout<<A[i]<<" ";

    }

}


int main() {

    /* Enter your code here. Read input from STDIN. Print output to STDOUT */ 

    int size;

    cin>>size;

    int A[size];

    for(int i =0;i<size;i++){

        cin>>A[i];

    }

    

    reverse(A,size);

    return 0;

 

}