๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.55K photos
3 videos
95 files
9.64K links
๐ŸšฉMain Group - @SuperExams
๐Ÿ“Job Updates - @FresherEarth

๐Ÿ”ฐAuthentic Coding Solutions(with Outputs)
โš ๏ธDaily Job Updates
โš ๏ธHackathon Updates & Solutions

Buy ads: https://telega.io/c/cs_algo
Download Telegram
public static int solution(int[] objects, int radius) {
        int n = objects.length;
        int maxIlluminated = 0;
        int bestPosition = Integer.MAX_VALUE;
        int left = 0;

        for (int right = 0; right < n; right++) {
            while (objects[right] - objects[left] > 2 * radius) {
                left++;
            }

            int count = right - left + 1;

            int candidatePosition = objects[right] - radius;
            candidatePosition = Math.max(candidatePosition, objects[left]);

            if (count > maxIlluminated) {
                maxIlluminated = count;
                bestPosition = candidatePosition;
            } else if (count == maxIlluminated) {
                bestPosition = Math.min(bestPosition, candidatePosition);
            }
        }

        return bestPosition;
    }

Coinbase (FTE) โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
Python
from typing import List
from collections import defaultdict

def parseNetworkChargebackInfo(rows: List[str]) -> List[str]:
    currency_conversion = {
        'EUR': 100, 'USD': 100, 'SGD': 100, 'BRL': 100,
        'JPY': 1, 'ISK': 1, 'KRW': 1, 'CAD': 100
    }

    valid_disputes = []
    withdrawn_disputes = defaultdict(dict)
    transaction_dates = {}

    for file_data in rows:
        lines = file_data.split('\n')
        file_info = lines[0].split('.')[0]
        network, date = file_info.split('_')
        headers = lines[1].split(',')
       
        field_indices = {field: headers.index(field) for field in
                         ['transaction', 'merchant', 'amount', 'currency', 'evidence_due_by', 'reason']}

        for line in lines[2:]:
            fields = line.split(',')
            if len(fields) < len(headers):
                continue

            transaction_id = fields[field_indices['transaction']]
            reason = fields[field_indices['reason']]
           
            try:
                amount = int(float(fields[field_indices['amount']]))
                currency = fields[field_indices['currency']]
                evidence_due_by = int(fields[field_indices['evidence_due_by']])
               
                if currency not in currency_conversion or amount < 0 or evidence_due_by < 0:
                    continue
            except (ValueError, KeyError):
                continue

            dispute_id = f"{network}{transaction_id}"
            merchant_id = fields[field_indices['merchant']]
            major_amount = amount / currency_conversion[currency]
            formatted_value = f"{major_amount:.2f}{currency}"

            if reason == 'withdrawn':
                withdrawn_disputes[network][transaction_id] = date
            else:
                valid_disputes.append((dispute_id, merchant_id, formatted_value, evidence_due_by, date))
           
            transaction_dates[transaction_id] = date

    output = []
    for dispute in valid_disputes:
        dispute_id, merchant_id, value, due_by, date = dispute
        network, transaction_id = dispute_id[:4], dispute_id[4:]
       
        if transaction_id in withdrawn_disputes[network]:
            if withdrawn_disputes[network][transaction_id] >= date:
                continue
       
        output.append(f"{dispute_id},{merchant_id},{value},{due_by}")

    return sorted(output)

# Sample test case
rows = [
    "VISA_20230601.csv\n"
    "transaction,merchant,amount,currency,evidence_due_by,reason\n"
    "123890132,47821,37906,USD,1686812400,fraudulent\n"
    "110450953,63724,12750,JPY,1686898800,duplicate\n",
    "JCB_20230604.csv\n"
    "transaction,merchant,currency,amount,evidence_due_by,reason\n"
    "110450953,11000,SGD,15000,1686898820,duplicate"
]

output = parseNetworkChargebackInfo(rows)
for line in output:
    print(line)


Stripe โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
def max_frame_sum(matrix, frameSize):
    n, m = len(matrix), len(matrix[0])
    max_sum = -1
    elems = set()
   
    for i in range(n - frameSize + 1):
        for j in range(m - frameSize + 1):
            s = 0
            s += sum(matrix[i][j:j+frameSize]) + sum(matrix[i+frameSize-1][j:j+frameSize])
            for k in range(i+1, i+frameSize-1):
                s += matrix[k][j] + matrix[k][j+frameSize-1]
            if s > max_sum:
                max_sum = s
                elems = set()
                elems.update(matrix[i][j:j+frameSize])
                elems.update(matrix[i+frameSize-1][j:j+frameSize])
                for k in range(i+1, i+frameSize-1):
                    elems.add(matrix[k][j])
                    elems.add(matrix[k][j+frameSize-1])
            elif s == max_sum:
                elems.update(matrix[i][j:j+frameSize])
                elems.update(matrix[i+frameSize-1][j:j+frameSize])
                for k in range(i+1, i+frameSize-1):
                    elems.add(matrix[k][j])
                    elems.add(matrix[k][j+frameSize-1])
   
    return sum(elems)


Coinbase(FTE)โœ…
9 hacks to boost your productivity:

1) Plan your day. Write everything on a physical paper.

2) Follow the 80/20 rule. 20% of your work will bring you 80% of the results.

3) Stop multitasking. Switching tasks significantly reduces your productivity.

4) Remove all distractions from your working environment.

5) When tried, take a nap.

6) Learn to say no, you will never have enough time if you say "yes" to everything.

7) Anything that can be done under 5 minutes. Do it at that instant.

8) Do that task that you hate first.

9) Set deadlines; the task will never be finished without deadlines.
https://www.linkedin.com/posts/vandanasingh16_backenddeveloper-golang-activity-7247630070675083264-Kr3Z?utm_source=share&utm_medium=member_desktop

๐Ÿš€ Join Us: Golang Backend Developer Opportunity! ๐Ÿš€
Are you a highly skilled Backend Developer with a passion for Golang? Do you thrive on solving complex problems and building systems that scale seamlessly? If you're looking to take your career to the next level and work with cutting-edge technology, we want to meet you!
Join our innovative team and play a key role in shaping the future of our platform.

๐ŸŽฏ This is your chance to make a real impact! ๐ŸŽฏ
Apply today and be part of a transformative journey.
Send your resume to kumari.vandana@viacom18.com.

Letโ€™s create something truly extraordinary together!