allcoding1
27.6K subscribers
2.2K photos
2 videos
77 files
853 links
Download Telegram
allcoding1
Photo
#include <iostream>
#include <sql.h>
#include <sqlext.h>

#define MAX_QUERY_LEN 1000

int main() {
// Declare variables for ODBC connection
SQLHENV henv;
SQLHDBC hdbc;
SQLHSTMT hstmt;
SQLRETURN retcode;

// Allocate environment handle
retcode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &amp;henv);

// Set the ODBC version to use
retcode = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0);

// Allocate connection handle
retcode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &amp;hdbc);

// Connect to the data source
retcode = SQLConnect(hdbc, (SQLCHAR*)"your_datasource", SQL_NTS, (SQLCHAR*)"username", SQL_NTS, (SQLCHAR*)"password", SQL_NTS);

// Allocate statement handle
retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &amp;hstmt);

// Prepare the SQL query
char query[MAX_QUERY_LEN] = "SELECT DATE_FORMAT(date_column, '%Y-%m') AS month_year, source, COUNT(*) AS total_number FROM your_table WHERE YEAR(date_column) = '2022' AND (source = 'Jobs' OR source = 'Freelancers') GROUP BY month_year, source ORDER BY month_year ASC, source ASC";

// Execute the SQL query
retcode = SQLExecDirect(hstmt, (SQLCHAR*)query, SQL_NTS);

// Fetch and process the results
while (SQLFetch(hstmt) == SQL_SUCCESS) {
// Process the retrieved data here
}

// Free the handles
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
SQLDisconnect(hdbc);
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
SQLFreeHandle(SQL_HANDLE_ENV, henv);

return 0;
}
Please note that the above code provides a basic framework for executing SQL queries in C++. You will need to replace your_datasource, username, password, your_table, and date_column with your actual database connection details, table name, and column name.

Telegram:- @allcoding1
👍4
int solve(int n, vector<int>& arr) {
    while (arr.size() > 1) {
        int len = INT_MAX;
        int idx = -1;
        for (int i = 0; i < arr.size() - 1; ++i) {
            int d = arr[i + 1];
            if (d == 0 || arr[i] == 0) {
                continue;
            }
            int r = min(arr[i] % d, d % arr[i]);
            if (r < len) {
                len = r;
                idx = i;
            }
        }
        if (idx == -1) {
            break;
        }
        int d = arr[idx + 1];
        if (d != 0) {
            arr[idx] = min(arr[idx] % d, d % arr[idx]);
        }
        arr.erase(arr.begin() + idx + 1);
    }
    return arr.size();
}

Women Day Mathematics Challenge

Telegram:- @allcoding1
👍1
Telegram:- @allcoding1
URL Hashing

Telegram:- @allcoding1
allcoding1
Photo
#define vv(a) vector<vector<int>>(a)
int solve(int n, int m, vector<vector<int>> &a)
{
vv(right)(n, vector<int>(m, 0));
vv(down)(n, vector<int>(m, 0));
vv(left)(n, vector<int>(m, 0));

for (int i = 0; i < n; i++)
{
int cnt = 0;
for (int j = m - 1; j >= 0; j--)
{
right[i][j] = cnt;
if (a[i][j] == 1)
cnt++;
}
}

for (int i = 0; i < n; i++)
{
int cnt = 0;
for (int j = 0; j < m; j++)
{
left[i][j] = cnt;
if (a[i][j] == 1)
cnt++;
}
}

for (int j = 0; j < m; j++)
{
int cnt = 0;
for (int i = n - 1; i >= 0; i--)
{
down[i][j] = cnt;
if (a[i][j] == 1)
cnt++;
}
}

int ans = 0;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
if (a[i][j] == 1)
{
ans += (right[i][j] * down[i][j]);
ans += (left[i][j] * down[i][j]);
}
}
}
return ans;
}
C++

Telegram:- @allcoding1
2👍2😁2
This media is not supported in your browser
VIEW IN TELEGRAM
👍1
struct Request {
    string id;
    string start_time;
    string end_time;
};

bool compare(Request a, Request b) {
    return a.start_time < b.start_time;
}

int solve(vector<Request> requests) {
    sort(requests.begin(), requests.end(), compare);
    int max_concurrent = 0;
    int current_concurrent = 0;
    string current_end_time = "00:00:00";

    for (Request request : requests) {
        if (request.start_time >= current_end_time) {
            current_concurrent--;
        } else {
            current_concurrent++;
            if (current_concurrent > max_concurrent) {
                max_concurrent = current_concurrent;
            }
        }
        if (request.end_time > current_end_time) {
            current_end_time = request.end_time;
        }
    }

    return max_concurrent;
}

@allcoding1_official
Monthly job postings and freelancer registrations report

@allcoding1
Long term Vs short term investment analysis

@allcoding1
👍1
Nvidia answer

1)011

2)16

3)64 4)i) 100W

ii)OW iii)20W

iv)0.357

5)8 and 16

6)z=0

7)2:1

8)9

9)0.44

10)200

11)40

12)3.0

13)16

14)750 and 50

15)500

16)60

17)5

18)657

19)250 and 96

20)24

@allcoding1
👍2
Company Name : Freshworks INC

Role : 1. Application Developer
           2. Software Developer

Package Freshers: 5LPA
Package Experience (1-2 yrs) : 7.5 LPA

Skills Needed : Java , Python , HTML, CSS, Java Script,  SQL and DBMS.

Location: Bangalore and Chennai (currently remote)

Passed out : 2021 - 2025

Round 1 : Coding Assessment Live in Google meet with interviewer (30 mins)

Round 2 : Technical Interview (30 mins)

Round 3 : HR Interview (20 mins)

https://docs.google.com/forms/d/e/1FAIpQLScSh9qPFBce3XvlCUbm4ZpIKuqTcN6IIsdTLPh2WXhAC4XRfQ/viewform?usp=sf_link
👍2
Company Name: Upstox
Role: SDE Intern
Batch eligible: 2023 and 2024 passouts

Apply: https://docs.google.com/forms/d/e/1FAIpQLSebiXUKhTEoHvCnZFPDCGPqart5Qt3X48ToLgHBY7caw2CFLA/viewform