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 / LoadCSV.cs
Created July 2, 2017 07:53
how to load a CSV value from a text file with the column head into a datagridview using c#
public static string[,] LoadCsv(string filename)
{
//get the file text
string text = System.IO.File.ReadAllText(filename);
//split into Lines
text = text.Replace("\n", "\r");
string[] lines = text.Split(new char[] { '\r' }, StringSplitOptions.RemoveEmptyEntries);
// to get how many rows and columns
Name: Flash
Serial: eNrzzU/OLi0odswsqnHLSSzOqDGoca7JKCkpsNLXLy8v1ytJTczVLUotKNFLzs8FAJHYETc=
if anyone wants to thank ETH: 0x527c2aB55b744D6167dc981576318af96ed26676
Thank you!
@abdulateef
abdulateef / QuicksortInPlace.cs
Last active November 5, 2016 12:55
Quicksort In-Place Solution in c#
using System;
using System.Collections.Generic;
using System.IO;
class Solution {
static void Main(String[] args)
{
int N = Convert.ToInt32(Console.ReadLine());
string[] arr_temp = Console.ReadLine().Split(' ');
int[] list1 = Array.ConvertAll(arr_temp,Int32.Parse);
Solution.quickSortInPlace(list1);
@abdulateef
abdulateef / InsertionSort2.cs
Created November 4, 2016 17:46
Hanker Rank Insertion Sort - Part 2 Solution in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Algorithms
{
class InsertionSort2
{
@abdulateef
abdulateef / WordCount.cs
Last active August 5, 2016 10:32
how to count the occurrence of a word in a text file using c#
public static void WordCount(string word, string path)
{
int index;
int occurrence = 0;
try
{
StreamReader reader = new StreamReader(path);
using(reader)
@abdulateef
abdulateef / HourGlass
Last active October 17, 2020 19:30
Solution to Calculate the hourglass sum for every hourglass in A, then print the maximum hourglass sum.
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution
{
public static void main(String[] args)
@abdulateef
abdulateef / binary.java
Last active November 23, 2017 19:39
Given a base- 10 integer, n , convert it to binary (base-2). Then find and print the base- 10 integer denoting the maximum number of consecutive 1's in n's binary representation.
import java.util.Scanner;
public class Binary
{
public static String convertToBinary(int decnumber)
{
String binaryString = " ";
if (decnumber > 0)
{
binaryString = Integer.toBinaryString(decnumber);
@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];