Skip to content

Instantly share code, notes, and snippets.

View Remonhasan's full-sized avatar
🐙
Hello, happy Friday!

Remon Hasan Remonhasan

🐙
Hello, happy Friday!
View GitHub Profile
@Remonhasan
Remonhasan / Find-Words-Containing-Character.cpp
Created May 29, 2024 11:47
Leetcode 2942 : Find Words Containing Character
class Solution {
public:
vector<int> findWordsContaining(vector<string>& words, char x) {
vector<int> wordIndex;
for (int i = 0; i < words.size(); ++i) {
if (find(words[i].begin(), words[i].end(), x) != words[i].end()) {
wordIndex.push_back(i);
}
}
@Remonhasan
Remonhasan / 409-longest-palindorme.cpp
Created May 20, 2024 12:11
Hash Map : Longest Palindrome (Leetcode)
// author : remonhasan
#include<bits/stdc++.h>
#include <unordered_map>
#include <string>
using namespace std;
#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int longestPalindrome(const std::string& s) {
unordered_map<char, int> charCount;
@Remonhasan
Remonhasan / CategoryController.php
Created April 24, 2024 08:48
Eloquent Query Scopes
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Category;
use App\Models\Permission;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache;
@Remonhasan
Remonhasan / AdminMiddleware.php
Last active April 23, 2024 05:25
Laravel Custom Middleware Class
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class AdminMiddleware
@Remonhasan
Remonhasan / Explanation.txt
Created April 18, 2024 05:23
Sum of the two largest differences in the sorted array - 1934A
Let's understand the solution provided with an example and explanation:
Suppose we have an array with 4 elements: [1, 3, 5, 8]. We'll sort this array in ascending order: [1, 3, 5, 8].
Now, let's consider the possible cases for the given expression:
|a−b|+|b−c|+|c−d|+|d−a|
|a−b|+|b−d|+|d−c|+|c−a|
|a−c|+|c−b|+|b−d|+|d−a|
We can see that in each case, the sum of absolute differences includes all pairs of adjacent elements.
@Remonhasan
Remonhasan / CategoryController.php
Last active April 16, 2024 09:35
Laravel Route Model Binding
/**
* Show all categories
* Route Model Binding
* Like the below route you can access all of the categories
* Access route sample: http://localhost:8000/admin/category/1
* @param mixed $category
* @return void
*/
public function show(Category $category)
{
@Remonhasan
Remonhasan / javascript-functions-handbook.txt
Last active December 5, 2022 18:55
JavaScript Functions Handbook
// Get Current Date and Time
const current = new Date();
const year = current.getFullYear();
const day = String(current.getDate()).padStart(2, '0');
const month = String(current.getMonth() + 1).padStart(2, '0');
const time = + current.getHours() + ":" + current.getMinutes() + ":" + current.getSeconds();
const currentDateTime = `${year}-${month}-${day} ${time}`;
const covertCurrentDateTime = DateTimeUtils.formatTimestamp(currentDateTime);
// Convert Time for Zoom Meeting
@Remonhasan
Remonhasan / data-preprossing.py
Last active August 3, 2020 09:19
Machine Learning - Import Dataset and Libreries
#Author: Remon Hasan
#University of Asia Pacific
#Data Preprocessing
#Import Libraries
#import Numpy -[ Numpy is a library that contains mathematical tools ]
import numpy as np
#import matplotlib & sublibrary Pyplot - [These library help us to plot]
import matplotlib.pyplot as plt
@Remonhasan
Remonhasan / Chinese Reminder Theorem concept 1.cpp
Created May 30, 2020 13:02
Chinese Reminder Theorem : Concept 01 [ Reminder ]
/* Author : Remon Hasan
Concept: Chinese Reminder Theorem [concept 1]
University of Asia Pacific
*/
#include<bits/stdc++.h>
using namespace std;
int find(int n[], int r[], int k)
{
int x=1;
@Remonhasan
Remonhasan / Extended Euclidean Algorithm.cpp
Created May 25, 2020 17:12
Uva Probelm 10104 using Extended Euclidean Algorithm
/* Author; Remon hasan
University of Asia Pacific
Algorithm : Extended Euclidean [ problem uva 10104 ]
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll eu(ll a, ll b, ll &x, ll &y)