Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Alla kurser & projekt | Codefinity

Filter

Språk

Nivå

Bläddra i vår katalog

Utforska spår, kurser och projekt – allt på ett ställe. Lär dig i din egen takt och bygg verkliga färdigheter.

Utmaning

Modified Sum Calculation

Given a list of integers and a threshold integer, return a sum of numbers, where each number contributes `2` if it exceeds or equals the threshold and `1` otherwise.

cpp
java
python
Utmaning

Maximize the Expression

Bill studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers `a`, `b`, `c` on the blackboard. The task was to insert signs of operations `+` and `*`, and probably brackets between the numbers so that the value of the resulting expression is as large as possible. Possible variants: - **a+b\*c=v1** - **a\*(b+c)=v2** - **a\*b\*c=v3** - **(a+b)\*c=v4** Note that you can insert operation signs only between `a` and `b`, and between `b` and `c`, that is, you cannot swap integers. For instance, in the given sample you cannot get expression **(a+c)\*b**. Given an integers `a`, `b` and `c`. Return **maximum value of the expression** that you can obtain.

cpp
java
js
python
r
c
Utmaning

Sort a Pair of Numbers

Given two integers `x` and `y`, return a list of integers: the first being the **minimum** of `x` and `y`, and the second being the **maximum** of `x` and `y`.

cpp
java
python
Utmaning

One Flip Game

Bob likes to play his game on paper. He writes `n` integers **a1, a2, ..., an**. Each of those integers can be either `0` or `1`. He's allowed to do exactly one move: he chooses two indices `i` and `j` **(1 ≤ i ≤ j ≤ n)** and flips all values `ak` for which their positions are in range `[i, j]` **(that is i ≤ k ≤ j)**. Flip the value of `ak` means to apply operation **ak = 1 - ak**. The goal of the game is that after exactly one move to obtain **the maximum number of ones**. Given a list of `0` or `1`. Return **the maximal number of 1s** that can be obtained after exactly one move.

r
c
cpp
java
js
python
Utmaning

Cake Division

One cozy afternoon, Lily and her friend Noah decided to buy a large cake from their favorite bakery. They chose the most decadent one, layered with rich frosting and fresh berries. After purchasing, the cake was weighed, showing a total weight of `n` grams. Excited to share it, they hurried home but soon realized they faced a tricky problem. Lily and Noah are big fans of even numbers, so they want to divide the cake in such a way that each of the two portions weighs an even number of grams. The portions don’t need to be equal, but each must have a positive weight. Since they’re both tired and eager to enjoy the cake, you need to help them determine if it’s possible to split it the way they want. Given an integer number `n` - the weight of cake bought by Lily and Noah, return a string `YES`, if Lily and Noah can divide the cake into two parts, each of them weighing an even number of grams and `NO` in the opposite case.

c
cpp
java
js
python
r
Utmaning

Large Powers of 5

Given an integer `n`, return the last two digits of the number 5 raised to the power of `n`. Note that `n` can be rather large, so direct computation may not be feasible. The task requires an efficient approach to solve the problem.

cpp
java
python
Utmaning

Equal Coins Distribution

Bob has three sisters: Ann, Bella, and Caroline. They're collecting coins. Currently, Ann has `a` coins, Bella has `b` coins and Caroline has `c` coins. Recently Bob has returned from the trip around the world and brought `n` coins. He wants to distribute all these `n` coins between his sisters in such a way that the number of coins Ann has is equal to the number of coins Bella has and is equal to the number of coins Caroline has. In other words, if Bob gives `A` coins to Ann, `B` coins to Bella and `C` coins to Caroline **A+B+C=n**, then **a+A=b+B=c+C** Note that `A`, `B` or `C` (the number of coins Bob gives to Ann, Bella and Caroline correspondingly) can be 0. Help Bob to find out if it is possible to distribute all `n` coins between sisters in a way described above. Given an integers `a` - the number of coins Ann has , `b` - number of coins Bella has, `c` - number of coins Caroline has and `n` - the number of coins Bob has. Return `YES` if Bob can distribute all `n` coins between his sisters and `NO` in the opposite case.

java
python
cpp
Utmaning

Bob's Bus Ticket Problem

Bob has recently started commuting by bus. We know that a one bus ride ticket costs `a` dollars. Besides, Bob found out that he can buy a special ticket for `m` rides, also he can buy it several times. It costs `b` dollars. Bob will need to use bus `n` times. Help Bob to calculate what is **the minimum sum of money** he will have to spend to make `n` rides?

cpp
java
python
Utmaning

Minimum Steps to Visit a Friend

Bill decided to visit his friend. It turned out that the Bill's house is located at point 0 and his friend's house is located at point `x` **(x > 0)** of the coordinate line. In one step Bill can move `1`, `2`, `3`, `4` or `5` positions forward. Given integer `x`, return **the minimum number of steps** Bill needs to make in order to get to his friend's house.

python
cpp
java
Utmaning

Lucky Ticket Validator

Given a ticket string consisting of **six digits**, return `YES` if its lucky and `NO` in the opposite case. A ticket is considered lucky if the sum of the first three digits is equal to the sum of the last three digits, even when there are leading zeroes.

java
python
cpp
Utmaning

Determine the Correct Arithmetic Operator

Given three integers `a`, `b`, and `c`, return `+` if the equation `a + b = c` is true, and `-` if the equation `a - b = c` is true

cpp
java
python
Utmaning

Balanced Athlete Team Splitting

You are given a team of athletes, each with a specific strength, numbered from 1 to n. Your goal is to divide these athletes into two teams, ensuring that each team contains at least one athlete and that each athlete belongs to only one team. The objective is to split the athletes in such a way that the difference between the strongest athlete in the first team and the weakest athlete in the second team is as small as possible. In other words, you want to minimize the absolute difference between the **maximum strength** in the first team **(max(A))** and the **minimum strength** in the second team **(min(B))**. Your task is to find and print the minimum value of |max(A) - min(B)|.

cpp
java
python
some-alt