Giter VIP home page Giter VIP logo

hackerrank's Introduction

hackerrank

My HackerRank codes

hackerrank's People

Contributors

adityathakurxd avatar charles-wangkai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hackerrank's Issues

another solution

you can also use the swap case built-in function
most people don't know that its exist

def swap_case(s):
    return s.swapcase()

if __name__ == '__main__':
    s = input()
    result = swap_case(s)
    print(result)

happy coding

This code is giving wrong output

It can be like this:

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);

	Map<String, String> name2phone = new HashMap<String, String>();

	int n = sc.nextInt();
	sc.nextLine();

	for (int i = 0; i < n; i++) {
		String name = sc.nextLine();
		String phone = sc.nextLine();

		name2phone.put(name, phone);
	}

	while (sc.hasNext()) {
		String name = sc.nextLine();

		if (name2phone.containsKey(name)) {
			System.out.println(name + "=" + name2phone.get(name));
		} else {
			System.out.println("Not found");
		}
	}

	sc.close();
}

}

Just need to do a little change. Thanks.

Small error

In line 21 and line 22 in the main code of even tree,write u1-1 and vi-1 instead of ui and vi,since they are giving out of bounds exception.
adjacentLists[ui-1].add(vi-1); adjacentLists[vi-1].add(ui-1);

I did same implementation in python but it is not working in some cases can you tell me what I am missing

`#!/bin/python3

import sys
import math

def encryption(s):
L = len(s)
r = math.floor(math.sqrt(L)) #2
c = math.ceil(math.sqrt(L)) #3
arr = []
n=0
for i in range(r):
a = []
for j in range(c):
if n < L:
a.append(s[n])
else:
break
n+=1
arr.append(a)
print(arr)
resStr = ''
for i in range(c):
for j in range(r):
try:
resStr += arr[j][i]
except IndexError:
break
resStr += ' '
return resStr

if name == "main":
s = input().strip()
result = encryption(s)
print(result)
`

Truck tour - hackerrank problem

Hello,
Did your "Truck Tour" problem solution passed all test cases? It seems may fail in many cases. If last petrol pump loads still causes fuel negative then where it should point?

Why is this recursive not correct?

public static boolean isFibo(int valueToCheck, int previousValue, int currentValue) {
return currentValue > valueToCheck ? false : valueToCheck == currentValue ? true : isFibo(valueToCheck, currentValue, currentValue + previousValue);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.