본문 바로가기

python-algorithm1422

leetcode 2843. Count Symmetric Integers https://leetcode.com/problems/count-symmetric-integers/description/ Count Symmetric Integers - LeetCode Can you solve this real interview question? Count Symmetric Integers - You are given two positive integers low and high. An integer x consisting of 2 * n digits is symmetric if the sum of the first n digits of x is equal to the sum of the last n digits of leetcode.com 123456789101112class Solu.. 2024. 1. 5.
leetcode 2894. Divisible and Non-divisible Sums Difference https://leetcode.com/problems/divisible-and-non-divisible-sums-difference/description/ Divisible and Non-divisible Sums Difference - LeetCode Can you solve this real interview question? 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.. 2024. 1. 5.
leetcode 2974. Minimum Number Game https://leetcode.com/problems/minimum-number-game/description/ Minimum Number Game - LeetCode Can you solve this real interview question? Minimum Number Game - You are given a 0-indexed integer array nums of even length and there is also an empty array arr. Alice and Bob decided to play a game where in every round Alice and Bob will do one move. Th leetcode.com 1234567891011121314class Solution:.. 2024. 1. 5.
leetcode 2643. Row With Maximum Ones https://leetcode.com/problems/row-with-maximum-ones/description/ Row With Maximum Ones - LeetCode Can you solve this real interview question? Row With Maximum Ones - Given a m x n binary matrix mat, find the 0-indexed position of the row that contains the maximum count of ones, and the number of ones in that row. In case there are multiple rows that ha leetcode.com 1234567891011class Solution: d.. 2024. 1. 2.
leetcode 2788. Split Strings by Separator https://leetcode.com/problems/split-strings-by-separator/description/ Split Strings by Separator - LeetCode Can you solve this real interview question? Split Strings by Separator - Given an array of strings words and a character separator, split each string in words by separator. Return an array of strings containing the new strings formed after the splits, excl leetcode.com 123456789class Solut.. 2024. 1. 2.
leetcode 2824. Count Pairs Whose Sum is Less than Target https://leetcode.com/problems/count-pairs-whose-sum-is-less-than-target/description/ Count Pairs Whose Sum is Less than Target - LeetCode Can you solve this real interview question? Count Pairs Whose Sum is Less than Target - Given a 0-indexed integer array nums of length n and an integer target, return the number of pairs (i, j) where 0 int: answer = 0 for i in range(len(nums)): for j in range(.. 2024. 1. 2.
leetcode 2729. Check if The Number is Fascinating https://leetcode.com/problems/check-if-the-number-is-fascinating/description/ Check if The Number is Fascinating - LeetCode Can you solve this real interview question? Check if The Number is Fascinating - You are given an integer n that consists of exactly 3 digits. We call the number n fascinating if, after the following modification, the resulting number contains all the digi leetcode.com 1234.. 2023. 12. 29.
leetcode 2903. Find Indices With Index and Value Difference I https://leetcode.com/problems/find-indices-with-index-and-value-difference-i/description/ Find Indices With Index and Value Difference I - LeetCode Can you solve this real interview question? Find Indices With Index and Value Difference I - You are given a 0-indexed integer array nums having length n, an integer indexDifference, and an integer valueDifference. Your task is to find two indices i .. 2023. 12. 28.
leetcode 2923. Find Champion I https://leetcode.com/problems/find-champion-i/description/ Find Champion I - LeetCode Can you solve this real interview question? Find Champion I - There are n teams numbered from 0 to n - 1 in a tournament. Given a 0-indexed 2D boolean matrix grid of size n * n. For all i, j that 0 2023. 12. 28.
leetcode 2697. Lexicographically Smallest Palindrome https://leetcode.com/problems/lexicographically-smallest-palindrome/description/ 1234567891011class Solution: def makeSmallestPalindrome(self, s: str) -> str: s = list(s) for i in range(len(s)//2): if s[i] != s[-(i+1)]: if s[i] 2023. 12. 28.
leetcode 2828. Check if a String Is an Acronym of Words https://leetcode.com/problems/check-if-a-string-is-an-acronym-of-words/description/ Check if a String Is an Acronym of Words - LeetCode Can you solve this real interview question? Check if a String Is an Acronym of Words - Given an array of strings words and a string s, determine if s is an acronym of words. The string s is considered an acronym of words if it can be formed by concatenatin leetc.. 2023. 12. 28.
백준 14913 등차수열에서 항 번호 찾기 https://www.acmicpc.net/problem/14913 14913번: 등차수열에서 항 번호 찾기 k가 몇 번째 항인지 출력한다. 만약, k가 주어진 a와 d로 만들어진 등차수열의 수가 아니면 "X"를 출력한다. www.acmicpc.net 1234567891011def sol(a, d, k): if (k - a) % d == 0 and (k - a) // d >= 0: return (k - a) // d + 1 else: return 'X' if __name__ == '__main__': a, d, k = map(int, input().split()) print(sol(a, d, k)) Colored by Color Scriptercs 2023. 12. 28.