본문 바로가기

Python1423

leetcode 2710. Remove Trailing Zeros From a String https://leetcode.com/problems/remove-trailing-zeros-from-a-string/description/ Remove Trailing Zeros From a String - LeetCode Can you solve this real interview question? Remove Trailing Zeros From a String - Given a positive integer num represented as a string, return the integer num without trailing zeros as a string. Example 1: Input: num = "51230100" Output: "512301" Explan leetcode.com 1 2 3.. 2023. 6. 26.
leetcode 2656. Maximum Sum With Exactly K Elements https://leetcode.com/problems/maximum-sum-with-exactly-k-elements/description/ Maximum Sum With Exactly K Elements - LeetCode Can you solve this real interview question? Maximum Sum With Exactly K Elements - You are given a 0-indexed integer array nums and an integer k. Your task is to perform the following operation exactly k times in order to maximize your score: 1. Select an e leetcode.com 1 .. 2023. 6. 26.
leetcode 35. Search Insert Position https://leetcode.com/problems/search-insert-position/description/?envType=study-plan-v2&envId=top-interview-150 Search Insert Position - LeetCode Can you solve this real interview question? Search Insert Position - Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You mus.. 2023. 6. 26.
leetcode 172. Factorial Trailing Zeroes https://leetcode.com/problems/factorial-trailing-zeroes/description/?envType=study-plan-v2&envId=top-interview-150 Factorial Trailing Zeroes - LeetCode Can you solve this real interview question? Factorial Trailing Zeroes - Given an integer n, return the number of trailing zeroes in n!. Note that n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1. Example 1: Input: n = 3 Output: 0 Explanation: 3! = 6,.. 2023. 6. 26.
leetcode 9. Palindrome Number https://leetcode.com/problems/palindrome-number/description/?envType=study-plan-v2&envId=top-interview-150 Palindrome Number - LeetCode Can you solve this real interview question? Palindrome Number - Given an integer x, return true if x is a palindrome, and false otherwise. Example 1: Input: x = 121 Output: true Explanation: 121 reads as 121 from left to right and from right to left. Ex leetcode.. 2023. 6. 26.
백준 1152 단어의 개수 https://www.acmicpc.net/problem/1152 1152번: 단어의 개수 첫 줄에 영어 대소문자와 공백으로 이루어진 문자열이 주어진다. 이 문자열의 길이는 1,000,000을 넘지 않는다. 단어는 공백 한 개로 구분되며, 공백이 연속해서 나오는 경우는 없다. 또한 문자열 www.acmicpc.net 1 2 3 s = input() print(len(s.split())) cs 2023. 6. 24.
백준 1157 단어 공부 https://www.acmicpc.net/problem/1157 1157번: 단어 공부 알파벳 대소문자로 된 단어가 주어지면, 이 단어에서 가장 많이 사용된 알파벳이 무엇인지 알아내는 프로그램을 작성하시오. 단, 대문자와 소문자를 구분하지 않는다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 from collections import Counter s = input().lower() counter = Counter(s) #print(counter.most_common(2)) if len(s) == 1: print(s.upper()) else: most1, most2 = counter.most_common(2) if most1[1] == most2[1]: print(.. 2023. 6. 24.
leetcode 242. Valid Anagram https://leetcode.com/problems/valid-anagram/description/?envType=study-plan-v2&envId=top-interview-150 Valid Anagram - LeetCode Can you solve this real interview question? Valid Anagram - Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using leetcode.com .. 2023. 6. 23.
leetcode 392. Is Subsequence https://leetcode.com/problems/is-subsequence/description/?envType=study-plan-v2&envId=top-interview-150 Is Subsequence - LeetCode Can you solve this real interview question? Is Subsequence - Given two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence of a string is a new string that is formed from the original string by deleting some (can be n leetcode.co.. 2023. 6. 19.
leetcode 13. Roman to Integer https://leetcode.com/problems/roman-to-integer/description/?envType=study-plan-v2&envId=top-interview-150 Roman to Integer - LeetCode Can you solve this real interview question? Roman to Integer - Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is written as II in Roman numeral, just tw leetcode.c.. 2023. 6. 19.
leetcode 27. Remove Element https://leetcode.com/problems/remove-element/description/?envType=study-plan-v2&envId=top-interview-150 Remove Element - LeetCode Can you solve this real interview question? Remove Element - Given an integer array nums and an integer val, remove all occurrences of val in nums in-place [https://en.wikipedia.org/wiki/In-place_algorithm]. The order of the elements may be changed. Then r leetcode.co.. 2023. 6. 19.
leetcode 744. Find Smallest Letter Greater Than Target https://leetcode.com/problems/find-smallest-letter-greater-than-target/description/ Find Smallest Letter Greater Than Target - LeetCode Can you solve this real interview question? Find Smallest Letter Greater Than Target - You are given an array of characters letters that is sorted in non-decreasing order, and a character target. There are at least two different characters in letters. Retu leetc.. 2023. 6. 9.