Coding | EXAMS | IBM ACCENTURE | VIRTUSA | IBM | AMAZON | TCS | EPAM | WILEY EDGE | TECH MAHINDRA | JPMORGAN | HCL | WIPRO
3.37K subscribers
1.13K photos
3 videos
17 files
373 links
Main channel https://t.me/Coding_000
Contact Admin 👉 @ILOVEU_143 for booking your exam slots
Web- https://coding000.github.io/Projects/
💯% clearance in any placement exams
OffCampus -https://t.me/Offcampus_000
Discussion- https://t.me/exams_discussion
Download Telegram
public int maxGoodLength(int matrix[][]){
        int N = matrix.length;
        int M = matrix[0].length;
        int maxGoodLength = 0;

        for (int L = Math.min(N, M); L > 0; L--) {
            outerLoop:
            for (int i = 0; i <= N - L; i++) {
                for (int j = 0; j <= M - L; j++) {
                    boolean allGreater = true;
                    for (int x = i; x < i + L; x++) {
                        for (int y = j; y < j + L; y++) {
                            if (matrix[x][y] < L) {
                                allGreater = false;
                                break;
                            }
                        }
                        if (!allGreater) {
                            break;
                        }
                    }

                    if (allGreater) {
                        maxGoodLength = L;
                        break outerLoop;
                    }
                }
            }

            if (maxGoodLength > 0) {
                break;
            }
        }

        return maxGoodLength;
    }

@Coding_000
🔥21👍1
int minimumMagic(int n, int m, vector<int> &price, vector<int> &magical_price)
    {
        int sum=0,count=0;
        for(int i=0;i<n;i++)
        {
             sum+=price[i];
        }
        if(sum<=m)
        {
            return 0;
        }
        vector<int> vec;
        for(int i=0;i<n;i++)
        {
            vec.push_back(price[i]-magical_price[i]);
        }
        sort(vec.begin(),vec.end());
        for(int i=n-1;i>=0;i--)
        {
            sum-=vec[i];
            count++;
            if(sum<=m)
            {
                return count;
            }
        }
        return -1;
    }
@Coding_000
👍2🔥1🥰1
class Solution{  
public:
    bool isBeautifulString(const string& s) {
        unordered_map<char, int> freq;

        for (char c : s) {
           freq[c]++;
        }

        int oddCount = 0;
        for (const auto& p : freq) {
            if (p.second % 2 != 0) {
                oddCount++;
           }
        }
        return oddCount <= 1;
    }
   
   
    long long noOfPairs(vector<string> &box)
    {
     
        int count = 0;
        int n = box.size();

 
        for (int i = 0; i < n - 1; i++) {
             for (int j = i + 1; j < n; j++) {
                 string concatenated = box[i] + box[j];

                 if (isBeautifulString(concatenated)) {
                     count++;
                }
            }
        }

       return count;
    }
};

@Coding_000
🔥4👍1
Geeksforgeeks

Job-A-Thon


Solutions uploaded MCQ & Codes 🆓

Share @Coding_000❤️
👍2😍2🔥1🤩1