[LeetCode] Apply Operations to Make Two Strings Equal

2896. Apply Operations to Make Two Strings Equal

You are given two 0-indexed binary strings s1 and s2, both of length n, and a positive integer x.

You can perform any of the following operations on the string s1 any number of times:

  • Choose two indices i and j, and flip both s1[i] and s1[j]. The cost of this operation is x.
  • Choose an index i such that i < n - 1 and flip both s1[i] and s1[i + 1]. The cost of this operation is 1.

Return the minimum cost needed to make the strings s1 and s2 equal, or return -1 if it is impossible.

Note that flipping a character means changing it from 0 to 1 or vice-versa.

Read more
[LeetCode] Minimum Processing Time

2895. Minimum Processing Time

You have n processors each having 4 cores and n * 4 tasks that need to be executed such that each core should perform only one task.

Given a 0-indexed integer array processorTime representing the time at which each processor becomes available for the first time and a 0-indexed integer array tasks representing the time it takes to execute each task, return the minimum time when all of the tasks have been executed by the processors.

Note: Each core executes the task independently of the others.

Read more
[LeetCode] Divisible and Non-divisible Sums Difference

2894. Divisible and Non-divisible Sums Difference

You are given positive integers n and m.

Define two integers, num1 and num2, as follows:

  • num1: The sum of all integers in the range [1, n] that are not divisible by m.
  • num2: The sum of all integers in the range [1, n] that are divisible by m.

Return the integer num1 - num2.

Read more
[Hacker Cup 2023 Round 1] Problem D: Today is Gonna be a Great DayRead more
[Hacker Cup 2023 Round 1] Problem C1: Back in Black (Chapter 1)Read more
[Hacker Cup 2023 Round 1] Problem B2: Sum 41 (Chapter 2)Read more
[Hacker Cup 2023 Round 1] Problem B1: Sum 41 (Chapter 1)Read more
[Hacker Cup 2023 Round 1] Problem A: Here Comes Santa ClausRead more
[Hacker Earth] Inverted cellsRead more
[Hacker Earth] The maximum numberRead more