CODING SOLUTION - Placement Jobs & Materials
145K subscribers
909 photos
20 files
571 links
🌀 ” Our Only Aim Is To Let Get Placed To You In A Reputed Company. “

Contact Admin:
instagram.com/offcampusjobsindia_it
Download Telegram
Python
A group of friends playing cards code
Telegram - t.me/codingsolution_IT
class Solution {
    public boolean judgeCircle(String moves) {
        int x = 0, y = 0;
        for (char move: moves.toCharArray()) {
            if (move == 'U') y--;
            else if (move == 'D') y++;
            else if (move == 'L') x--;
            else if (move == 'R') x++;
        }
        return x == 0 && y == 0;
    }
}

Robot movement Code
Telegram - t.me/codingsolution_IT
from itertools import permutations

def count(arr):
    z=[]
    perm = permutations(arr)
    
    for i in list(perm):
        z.append(list(i))
    q=[]
    
    for i in range(len(arr)-1):
        x,y=arr[i],arr[i+1]
        
        for j in range(len(z)):
            if z[j].index(x)!=len(z[j])-1:
                if z[j][z[j].index(x)+1]==y:
                    q.append(z[j])
                    
    for i in range(len(q)):
         if q[i] in z:
             z.remove(q[i])
    return len(z)
a= int(input())
b=list(map(int,input().strip().split()))
print(count(b))

Python
Telegram - t.me/codingsolution_IT
if (n > k && n > a)
{
printf("N is the Biggest number is %d", n);
return n;
}
if (k > n && k > a)
{
printf("k is the Biggest number is %d", k);
return k;
}
if (a > n && a > k)
{
printf("a is the Biggest number is %d", a);
return a;
}

Telegram - t.me/codingsolution_IT
#include <bits/stdc++.h>
using namespace std;


int count(string s)
{
int N, i, cnt = 0, ans = 0;


N = s.length();

for (i = 0; i < N; i++) {
if (s[i] == 'R')
cnt++;

if (s[i] == 'L')
ans += cnt;
}

return ans;
}


int main()
{

string s = "RRLL";

cout << count(s) << endl;

return 0;
}

C++
Telegram - t.me/codingsolution_IT