**Notice**

**Recent Posts**

**Recent Comments**

일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|

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 |

**Tags**

- 코로나19
- 금융문자분석경진대회
- 프로그래머스
- dacon
- Real or Not? NLP with Disaster Tweets
- gs25
- SW Expert Academy
- ubuntu
- PYTHON
- Git
- 맥북
- 파이썬
- 캐치카페
- hackerrank
- 편스토랑 우승상품
- AI 경진대회
- github
- 백준
- 데이콘
- 편스토랑
- programmers
- 더현대서울 맛집
- leetcode
- 프로그래머스 파이썬
- Kaggle
- 자연어처리
- Baekjoon
- ChatGPT
- Docker
- 우분투

**Archives**

- Today

- Total

**관리 메뉴**

## 목록
반응형
hackerrank (25)

## 솜씨좋은장씨

**[HackerRank] Reverse a doubly linked list (Python)**

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..

**[HackerRank] Insert a node at a specific position in a linked list (Python)**

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..

**[HackerRank] Day 14: Scope (Python)**

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..

**[HackerRank] Sorting: Comparator (Python)**

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..

**[HackerRank] HackerRank in a String! (Python)**

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], ...

**[HackerRank] Stock Maximize (Python)**

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 ..

**[HackerRank] Grading Students (Python)**

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..

**[HackerRank] Minimum Absolute Difference in an Array (Python)**

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..

**[HackerRank] Time Conversion (Python)**

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..

**[HackerRank] Birthday Cake Candles (Python)**

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..

**[HackerRank] Stack and Queues : A Tale of Two Stacks**

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..

**[HackerRank] Min-Max Sum (Python)**

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..

**[HackerRank] Staircase (Python)**

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..

**[HackerRank] String Manipulation : Alternating Characters (Python)**

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..

**[HackerRank] Sorting : Mark and Toys (Python)**

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..

**[HackerRank] Hash Tables : Ransom Note (Python)**

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..

**[HackerRank] Stacks and Queues : Balanced Brackets (Python)**

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..

**[HackerRank] Plus Minus (Python)**

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..

**[HackerRank] Diagonal Difference (Python)**

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 ..

**[HackerRank] Dictionaries and Hashmaps: Two Strings (Python)**

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..

**[HackerRank] Arrays: Array Manipulation (Python)**

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..

**[HackerRank] Arrays: Minimum Swaps 2 (Python)**

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, ..

**[HackerRank] Sorting: Bubble Sort (Python)**

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..

**[HackerRank] Repeated String (Python)**

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..

**[HackerRank] Counting Valleys (Python)**

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..