TPHUNTERSCPP Telegram 199
Tp hunters cpp
🧠 #کد_چالش حل توسط : چند نفر از دوستان, اما ساده و بهترین کد کد زیر میباشد. // C++ implementation of the approach #include <bits/stdc++.h> using namespace std; // Function to return the count of // valid indices pairs int countPairs(string s1, int n1, string…
💬 #شرح_چالش
توضیحات : محمدصالح حق محمدلو

ما درواقع دوتا رشته داریم که میخوایم تمام کارکتر های مشترک بین اون دوتارو بشمریم. یعنی باید
s1[i] = s2[j]
برقرار باشه
درابتدا ما میایم فرکانس(اشتراک/فراوانی) تمام کارکتر های هر دو رشته رو میشمریم.
حالا برای تمام کارکتر ها اگر فرکانس(اشتراک/فراوانی) این کارکتر در رشته s1 برابر با freq1 و در رشته s2 برابر با freq2 باشد، نتیجه مجموع زوج های مشترک در نتیجه تابع
min(freq1,freq2)
قرار میگیرد.
حال مجموع این مقدار برای همه کارکتر ها جواب مورد نظر ماست.
این یک تابع خطی از نظر مرتبه زمانی bigO میباشد و یک تابع بهینه است👌

🟢لطفا سوالات، نظرات و کد های خود را برای ما کامنت کنید.



tgoop.com/tphunterscpp/199
Create:
Last Update:

💬 #شرح_چالش
توضیحات : محمدصالح حق محمدلو

ما درواقع دوتا رشته داریم که میخوایم تمام کارکتر های مشترک بین اون دوتارو بشمریم. یعنی باید
s1[i] = s2[j]
برقرار باشه
درابتدا ما میایم فرکانس(اشتراک/فراوانی) تمام کارکتر های هر دو رشته رو میشمریم.
حالا برای تمام کارکتر ها اگر فرکانس(اشتراک/فراوانی) این کارکتر در رشته s1 برابر با freq1 و در رشته s2 برابر با freq2 باشد، نتیجه مجموع زوج های مشترک در نتیجه تابع
min(freq1,freq2)
قرار میگیرد.
حال مجموع این مقدار برای همه کارکتر ها جواب مورد نظر ماست.
این یک تابع خطی از نظر مرتبه زمانی bigO میباشد و یک تابع بهینه است👌

🟢لطفا سوالات، نظرات و کد های خود را برای ما کامنت کنید.

BY Tp hunters cpp


Share with your friend now:
tgoop.com/tphunterscpp/199

View MORE
Open in Telegram


Telegram News

Date: |

The court said the defendant had also incited people to commit public nuisance, with messages calling on them to take part in rallies and demonstrations including at Hong Kong International Airport, to block roads and to paralyse the public transportation system. Various forms of protest promoted on the messaging platform included general strikes, lunchtime protests and silent sit-ins. Telegram is a leading cloud-based instant messages platform. It became popular in recent years for its privacy, speed, voice and video quality, and other unmatched features over its main competitor Whatsapp. The initiatives announced by Perekopsky include monitoring the content in groups. According to the executive, posts identified as lacking context or as containing false information will be flagged as a potential source of disinformation. The content is then forwarded to Telegram's fact-checking channels for analysis and subsequent publication of verified information. A Telegram channel is used for various purposes, from sharing helpful content to implementing a business strategy. In addition, you can use your channel to build and improve your company image, boost your sales, make profits, enhance customer loyalty, and more. Hashtags are a fast way to find the correct information on social media. To put your content out there, be sure to add hashtags to each post. We have two intelligent tips to give you:
from us


Telegram Tp hunters cpp
FROM American