- 2024-09-23算法题之宝石与石头
宝石与石头给你一个字符串 jewels 代表石头中宝石的类型,另有一个字符串 stones 代表你拥有的石头。 stones 中每个字符代表了一种你拥有的石头的类型,你想知道你拥有的石头中有多少是宝石。字母区分大小写,因此 "a" 和 "A" 是不同类型的石头。示例1:输入:jewels="
- 2024-07-19D. Buying Jewels
原题链接题解构造题,先想特殊情况再验证构造一个\(n-k+1,1\)不成立的条件是\(2*(n-k+1)\leqn\),相当于\(2k\geqn+2\),即k大于n的一半,能构造的第一多的k是n,第二多是\(n/2+1\),易得不成立code#include<bits/stdc++.h>#definelllonglongusingnamespacestd
- 2024-04-12D. Buying Jewels
D.BuyingJewelsAlicehas$n$coinsandwantstoshopatBob'sjewelrystore.Today,althoughBobhasnotsetupthestoreyet,BobwantstomakesureAlicewillbuyexactly$k$jewels.Tosetupthestore,Bobcanerectatmost$60$stalls(eachco
- 2024-03-24宝石与石头
宝石与石头链接:https://leetcode.cn/problems/jewels-and-stones/description/给你⼀个字符串jewels代表石头中宝石的类型,另有⼀个字符串stones代表你拥有的石头。stones中每个字符代表了⼀种你拥有的石头的类型,你想知道你拥有的石头中有多少是宝石。字母区分大小
- 2023-09-12【Leetcode】解题报告Day1~Day2
解题报告Day11.2235.两数之和给你两个整数num1和num2,返回这两个整数的和。示例1:输入:num1=12,num2=5输出:17解释:num1是12,num2是5,它们的和是12+5=17,因此返回17。示例2:输入:num1=-10,num2=4输出:-6解释:num1+num2=-6,因此返回-6。提示:
- 2023-05-30leetcode 771. Jewels and Stones
You'regivenstrings J representingthetypesofstonesthatarejewels,and S representingthestonesyouhave. Eachcharacterin Sisatypeofstoneyouhave. Youwanttoknowhowmanyofthestonesyouhavearealsojewels.Thelettersin J areg
- 2023-03-23[leeccode]771. Jewels and Stones
J representingthetypesofstonesthatarejewels,and S representingthestonesyouhave. Eachcharacterin Sisatypeofstoneyouhave. Youwantto
- 2023-02-143600、宝石与石头
给你一个字符串jewels代表石头中宝石的类型,另有一个字符串stones代表你拥有的石头。stones中每个字符代表了一种你拥有的石头的类型,你想知道你拥有的石头中有多少是宝
- 2023-01-23[AGC031E] Snuke the Phantom Thief
ProblemStatementAmuseumexhibits$N$jewels,Jewel$1,2,...,N$.ThecoordinatesofJewel$i$are$(x_i,y_i)$(themuseumcanberegardedasatwo-dimen
- 2022-11-04leetcode-771-easy
JewelsandStonesYou'regivenstringsjewelsrepresentingthetypesofstonesthatarejewels,andstonesrepresentingthestonesyouhave.Eachcharacterin