Skip to content

Instantly share code, notes, and snippets.

View abdulateef's full-sized avatar

Abdulateef abdulateef

  • sekat technologies
  • Lagos Nigeria
View GitHub Profile
@abdulateef
abdulateef / factorial.java
Created June 20, 2016 08:21
Write a factorial function that takes a positive integer, N as a parameter and prints the result of N! ( N factorial).
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static int factorial(int n)//factorial method
{
if (n == 0)
@abdulateef
abdulateef / phonebook.java
Created June 20, 2016 07:55
Given names and phone numbers, assemble a phone book that maps friends' names to their respective phone numbers. You will then be given an unknown number of names to query your phone book for; for each name queried, print the associated entry from your phone book (in the form name=phonenumber ) or NOT FOUND if there is no entry for .name
//Day8
import java.util.*;
import java.io.*;
class Solution{
public static void main(String []argh)
{
Map<String,Long> phonebook = new java.util.HashMap<>();
Scanner in = new Scanner(System.in);
int n = in.nextInt();
@abdulateef
abdulateef / String.java
Created June 18, 2016 08:02
Given a string,S , of length that is indexed from 0 to N-1 , print its even-indexed and odd-indexed characters as space-separated strings on a single line . Note:0 is considered to be an even index.
import java.util.Scanner;
public class Day6{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int n = input.nextInt();
input.nextLine();
String[] words = new String[n];
@abdulateef
abdulateef / reverse.java
Last active May 14, 2021 14:33
Given an array, A, of N integers, print A's elements in reverse order as a single line of space-separated numbers.
import java.util.Scanner;
public class Reverse{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// System.out.println("Enter the size of the array");
int n = input.nextInt();
int[] arr = new int[n];
// System.out.println("Enter array values");
for(int i=0; i<n; i++){