일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 맥북
- Git
- PYTHON
- ChatGPT
- Kaggle
- SW Expert Academy
- 더현대서울 맛집
- Docker
- hackerrank
- ubuntu
- 파이썬
- 편스토랑
- github
- programmers
- Real or Not? NLP with Disaster Tweets
- dacon
- 프로그래머스
- 데이콘
- 캐치카페
- gs25
- 자연어처리
- 코로나19
- 우분투
- 백준
- leetcode
- 프로그래머스 파이썬
- AI 경진대회
- 편스토랑 우승상품
- Baekjoon
- 금융문자분석경진대회
- Today
- Total
목록
반응형
hackerrank (25)
솜씨좋은장씨
Given the pointer to the head node of a doubly linked list, reverse the order of the nodes in place. That is, change the next and prev pointers of the nodes so that the direction of the list is reversed. Return a reference to the head node of the reversed list. Note: The head node might be NULL to indicate that the list is empty. Function Description Complete the reverse function in the editor b..
Given the pointer to the head node of a linked list and an integer to insert at a certain position, create a new node with the given integer as its data attribute, insert this node at the desired position and return the head node. A position of 0 indicates head, a position of 1 indicates one node away from the head and so on. The head pointer given may be null meaning that the initial list is em..
The absolute difference between two integers, a and b, is written as |a - b|. The maximum absolute difference between two integers in a set of positive integers, elements, is the largest absolute difference between any two integers in elements. The Difference class is started for you in the editor. It has a private integer array (elements) for storing N non-negative integers, and a public intege..
Comparators are used to compare two objects. In this challenge, you'll create a comparator and use it to sort an array. The Player class is provided in the editor below. It has two fields: name : a string. score : an integer. Given an array of n Player objects, write a comparator that sorts them in order of decreasing score. If 2 or more players have the same score, sort those players alphabetic..
We say that a string contains the word hackerrank if a subsequence of its characters spell the word hackerrank. For example, if string s = haacckkerrannkk it does contain hackerrank, but s = haacckkerannk does not. In the second case, the second r is missing. If we reorder the first string as hccaakkerrannkk, it no longer contains the subsequence due to ordering. More formally, let p[0], p[1], ...
Your algorithms have become so good at predicting the market that you now know what the share price of Wooden Orange Toothpicks Inc. (WOT) will be for the next number of days. Each day, you can either buy one share of WOT, sell any number of shares of WOT that you own, or not make any transaction at all. What is the maximum profit you can obtain with an optimum trading strategy? For example, if ..
HackerLand University has the following grading policy: Every student receives a grade in the inclusive range from 0 to 100. Any grade less than 40 is a failing grade. Sam is a professor at the university and likes to round each student's grade according to these rules: If the difference between the grade and the next multiple of 5 is less than 3, round grade up to the next multiple of 5. If the..
Consider an array of integers, arr = [ arr [0], arr [1], ... , arr [n - 1]]. We define the absolute difference between two elements, a[i] and a[j] (where i != j), to be the absolute value of a[i] - a[j]. Given an array of integers, find and print the minimum absolute difference between any two elements in the array. For example, given the array arr = [ -2, 2, 4 ] we can create 3 pairs of numbers..
Given a time in 12-hour AM/PM format, convert it to military (24-hour) time. Note: Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a 24-hour clock. Function Description Complete the timeConversion function in the editor below. It should return a new string representing the input time in 24 hour format. timeConvers..
You are in charge of the cake for your niece's birthday and have decided the cake will have one candle for each year of her total age. When she blows out the candles, she’ll only be able to blow out the tallest ones. Your task is to find out how many candles she can successfully blow out. For example, if your niece is turning 4 years old, and the cake will have 4 candles of height 4, 4, 1, 3, sh..
A queue is an abstract data type that maintains the order in which elements were added to it, allowing the oldest elements to be removed from the front and new elements to be added to the rear. This is called a First-In-First-Out (FIFO) data structure because the first element added to the queue (i.e., the one that has been waiting the longest) is always the first one to be removed. A basic queu..
Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers. For example, arr = [ 1, 3, 5, 7, 9 ]. Our minimum sum is 1 + 3 + 5 + 7 = 16 and our maximum sum is 3 + 5 + 7 + 9 = 24. We would print 16 24 Function Descri..
Consider a staircase of size : n = 4 # ## ### #### Observe that its base and height are both equal to n, and the image is drawn using # symbols and spaces. The last line is not preceded by any spaces. Write a program that prints a staircase of size n. Function Description Complete the staircase function in the editor below. It should print a staircase as described above. staircase has the follow..
You are given a string containing characters A and B only. Your task is to change it into a string such that there are no matching adjacent characters. To do this, you are allowed to delete zero or more characters in the string. Your task is to find the minimum number of required deletions. For example, given the string s = AABAAB, remove an A at positions 0 and 3 to make s = ABAB in 2 deletions..
Mark and Jane are very happy after having their first child. Their son loves toys, so Mark wants to buy some. There are a number of different toys lying in front of him, tagged with their prices. Mark has only a certain amount to spend, and he wants to maximize the number of toys he buys with this money. Given a list of prices and an amount to spend, what is the maximum number of toys Mark can b..
Harold is a kidnapper who wrote a ransom note, but now he is worried it will be traced back to him through his handwriting. He found a magazine and wants to know if he can cut out whole words from it and use them to create an untraceable replica of his ransom note. The words in his note are case-sensitive and he must use only whole words available in the magazine. He cannot use substrings or con..
A bracket is considered to be any one of the following characters: (, ), {, }, [, or ]. Two brackets are considered to be a matched pair if the an opening bracket (i.e., (, [, or {) occurs to the left of a closing bracket (i.e., ), ], or }) of the exact same type. There are three types of matched pairs of brackets: [], {}, and (). A matching pair of brackets is not balanced if the set of bracket..
Given an array of integers, calculate the fractions of its elements that are positive, negative, and are zeros. Print the decimal value of each fraction on a new line. Note: This challenge introduces precision problems. The test cases are scaled to six decimal places, though answers with absolute error of up to 10^(-4) are acceptable. For example, given the array arr = [1, 1, 0, -1, -1 ] there a..
Given a square matrix, calculate the absolute difference between the sums of its diagonals. For example, the square matrix arr is shown below: 1 2 3 4 5 6 9 8 9 The left-to-right diagonal = 1 + 5 + 9 = 15. The right to left diagonal = 3 + 5 + 9 = 17. Their absolute difference is | 15 - 17 | = 2. Function description Complete the diagonalDifference function in the editor below. It must return an ..
Given two strings, determine if they share a common substring. A substring may be as small as one character. For example, the words "a", "and", "art" share the common substring a. The words "be" and "cat" do not share a substring. Function Description Complete the function twoStrings in the editor below. It should return a string, either YES or NO based on whether the strings share a common subs..
Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each of the array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in your array. For example, the length of your array of zeros n = 10. Your list of queries is as follows: a b k 1 5 3 4 8 7 6 9 1 Add the values of k between the indic..
You are given an unordered array consisting of consecutive integers [1, 2, 3, ..., n] without any duplicates. You are allowed to swap any two elements. You need to find the minimum number of swaps required to sort the array in ascending order. For example, given the array arr = [ 7, 1, 3, 2, 4, 5, 6, ] we perform the following steps: i arr swap (indices) 0 [7, 1, 3, 2, 4, 5, 6] swap (0,3) 1 [2, ..
Consider the following version of Bubble Sort: for (int i = 0; i a[j + 1]) { swap(a[j], a[j + 1]); } } } Given an array of integers, sort the array in ascending order using the Bubble Sort algorithm above. Once sorted, print the following three lines: Array is sorted in numSwaps swa..
Lilah has a string, s, of lowercase English letters that she repeated infinitely many times. Given an integer, n, find and print the number of letter a's in the first n letters of Lilah's infinite string. For example, if the string s = 'abcac' and n = 10, the substring we consider is abcacabcac, the first 10 characters of her infinite string. There are 4 occurrences of a in the substring. Functi..
Gary is an avid hiker. He tracks his hikes meticulously, paying close attention to small details like topography. During his last hike he took exactly n steps. For every step he took, he noted if it was an uphill, U , or a downhill, D step. Gary's hikes start and end at sea level and each step up or down represents a 1 unit change in altitude. We define the following terms: A mountain is a seque..