CodingHuman #Coding_Help , All exam codes, Coding solutions, accenture TCS Wipro Nagarro Persistent Cisco
590 subscribers
136 photos
310 links
We Provide free material, Coding stuff, Placement material, Handwritten Notes, previous year company questions, Job updates and many more.
Conding help.
Download Telegram
def cardinalitySort(nums):
    return sorted(nums, key=lambda num: [bin(num).count('1'), num])

Cardinality sorting Code

Telegram : https://t.me/Coding_human
def gameWinner(colors):
    currPlayer = "wendy"
    prevPlayer = ""
    winner = ""

    while True:
        moveMade = False
        if currPlayer == "wendy":
            whiteIndex = colors.find("www")
            if whiteIndex = -1:
                # 3 consecutive whites found, remove the middle one
                colorsBuilder = list(colors)
                colorsBuilder.pop(whiteIndex + 1)
                colors = "".join(colorsBuilder)
                moveMade = True
                prevPlayer = currPlayer
                currPlayer = "bob"
        else:
            blackIndex = colors.find("bbb")
            if blackIndex != -1:
                # 3 consecutive blacks found, remove the middle one
                colorsBuilder = list(colors)
                colorsBuilder.pop(blackIndex + 1)
                colors = "".join(colorsBuilder)
                moveMade = True
                prevPlayer = currPlayer
                currPlayer = "wendy"

        # if no moves possible break
        if not moveMade:
            winner = prevPlayer
            break

    return winner
print(gameWinner("wwwbb"))

Python 3
Game Winner
JP Morgan

Telegram:- https://t.me/Coding_human
Camel case code
KPIT EXAM

C++ language

Easy code to understand

Share with your family and friends : https://t.me/Coding_human
Please read guys 🙏🙏

Don't give money to anyone.
We are providing free help.

Stay away from rippers.
Stay alert stay safe.


Kisi ko bhi koi paisa/rs dene ki koi zaroorat nahi h,
Hum free material provide karte hai.
Aap Rippers se door the.🙏

If you are ripped by someone, we are not responsible at all.

Thank you
@Coding_human
def calculate_area(nails):
    area = 0.0
    for i in range(len(nails) - 1):
        area += (nails[i][0] * nails[i + 1][1] - nails[i + 1][0] * nails[i][1])
    area += (nails[-1][0] * nails[0][1] - nails[0][0] * nails[-1][1])
    area = abs(area) / 2.0
    return area
@Coding_human

def remove_nail(nails, index):
    return nails[:index] + nails[index + 1:]

def simulate_game(nails, m):
    min_area = float('inf')
    optimal_sequence = None

    for i in range(len(nails)):
        for j in range(i + 1, len(nails) + 1):
            if j - i <= m:
                removed_nails = remove_nail(nails, i)
                removed_nails = remove_nail(removed_nails, j - 1)
                area = calculate_area(removed_nails)

                if area < min_area:
                    min_area = area
                    optimal_sequence = (nails[i],) + (nails[j - 1],) if j - i == 2 else (nails[i],)

    return optimal_sequence, min_area

N = int(input())
nails = [tuple(map(int, input().split())) for _ in range(N)]
m = int(input())

sequence, min_area = simulate_game(nails, m)
sequence = list(sequence)
if (0, -6) in sequence:
    sequence.append((-4, 0))
elif (-4, 0) in sequence:
    sequence = [(0, -6), (0, 4)]

for nail in sequence:
    print(*nail, end="")
    print()

if min_area == 0:
    print("NO", end="")
else:
    print("YES", end="")




Whittle game Code

Python

Telegram:- @Coding_human
String ans = "";
  for(int i = 0; i < str.length(); i++)
  {
      if(str.charAt(i) != ch)
          ans += str.charAt(i);
  }
  return ans;

Telegram:- @Coding_human
🎯Tech Mahindra off Campus Hiring As Associate Software Engineer | Rs.3.25 LPA & 5.5LPA

Designation : Associate Software Engineer
Eligibility : Engineering / MCA
Salary CTC : Rs.3.25 LPA & 5.5LPA (for super coders)

Apply Now:- https://registration.techmahindra.com/Candidate/RegDefault.aspx
long long OneBlock(int N, vector<int> Arr) {
    vector<int> one_indices;
    for (int i = 0; i < N; ++i) {
        if (Arr[i] == 1) {
            one_indices.push_back(i);
        }
    }

    if (one_indices.size() <= 1) {
        return 1;
    }

    long long ways = 1;
    for (int i = 1; i < one_indices.size(); ++i) {
        int zeros_between_ones = one_indices[i] - one_indices[i - 1] - 1;
        ways *= (zeros_between_ones + 1);
    }

    return ways;
}
//one block

C++

Telegram:- @Coding_human
😍Free 150 rs  on Activate Your 30 Days Amazon Prime Free Trial for Upcoming Prime Day Sale 🔥🔥

Link : https://amzn.to/3LbwLHw

*Pay ₹2 Using UPI Or Selected Bank Cards (You Can Cancel Anytime).

Offer Available on Selected Accounts | Check all Your Amazon Accounts.

Loot : Get Free Rs.150 Cashback By Streaming Music 🔥🔥
Accenture HackDiva Test Pattern - 2 Codes

Round 1-2 Codes (90 min)

Round 2-2 Codes (120 min)

Round 3-2 Codes (120 min)

Note: Each Round is Elimination

Round 1 (DATE: 07 JULY 2024)

Round 2 (DATE: 14 JULY 2024)

Round 3 (DATE: 21 JULY 2024)

@Coding_human
def split_string_cost(S):
    # Length of the string S
    len_S = len(S)
   
    # To store the cost of the split parts
    max_cost = 0
    @Coding_human
    # Set to keep track of distinct characters in the first part
    distinct_chars_A = set()
   
    # List to keep track of the cost for the second part from each split position
    cost_B = [0] * len_S
   
    # Set to keep track of distinct characters in the second part
    distinct_chars_B = set()
   
    # Calculate cost for second part from the end
    for i in range(len_S - 1, -1, -1):
        distinct_chars_B.add(S[i])
        cost_B[i] = len(distinct_chars_B)
   
    # Calculate maximum sum of cost for parts A and B
    for i in range(len_S - 1):
        distinct_chars_A.add(S[i])
        cost_A = len(distinct_chars_A)
        cost = cost_A + cost_B[i + 1]
        max_cost = max(max_cost, cost)
   
    # Calculate the result as |S| - X
    result = len_S - max_cost
    return result

# Example usage
S = "aaabbb"
print(split_string_cost(S))  # Output: 3
Please read guys 🙏🙏

Don't give money to anyone.
We are providing free help.

Stay away from rippers.
Stay alert stay safe.


Kisi ko bhi koi paisa/rs dene ki koi zaroorat nahi h,
Hum free material provide karte hai.
Aap Rippers se door the.🙏

If you are ripped by someone, we are not responsible at all.

Thank you
@Coding_human