This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\Auth; | |
use Symfony\Component\HttpFoundation\Response; | |
class AdminMiddleware |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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) |
NewerOlder