Skip to content

Instantly share code, notes, and snippets.

class Solution {
public boolean check(int freq[], int k) {
//check all characters count
for(int p : freq)
if(p != 0 && p < k)
return false;
return true;
}
class Solution {
public:
bool check(vector<int> &freq, int k)
{
//check all characters count
for(int p : freq)
if(p != 0 && p < k)
return false;
class Solution {
public String longestCommonPrefix(String[] strs) {
//edge case, empty array
if(strs==null || strs.length==0) return "";
//empty string
String ans="";
//200 is the max possible length of string, as per constraints
class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
//edge case, empty array
if(strs.empty()) return "";
//empty string
string ans;
<template>
<div class="image-upload container">
<h2>Add a new Image</h2>
<label for="myfile"><h3>Select image :</h3></label>
<input type="file" id="myfile" @change="onFileSelected">
<br>
<button type="button" class="btn btn-info" @click="onUpload">Upload</button>
</div>
</template>
<template>
<div class="image-box">
<img :src="image.url" :alt="image.name" class="img-fluid my-image" ref="rimage">
<div class="middle">
<button class="btn btn-info" @click="copyToClipboard">Copy Address</button>
</div>
</div>
</template>
<script>
<template>
<div class="editProduct container">
<h2>Edit Product</h2>
<form>
<div class="form-group">
<label>Category</label>
<select class="form-control" v-model="category_id" required>
<option v-for="category of categories" :key="category.id" :value="category.id">{{category.categoryName}}</option>
</select>
</div>
<template>
<div class="product-box">
<div class="row">
<div class="col-4">
<img class="img-fluid" v-bind:src="product.imageURL" alt="product-image">
</div>
<div class="col-8">
<router-link :to="{name : 'EditProduct', params : {id : product.id} }">
<button class="btn btn-primary edit_btn">Edit</button>
</router-link>
<template>
<div class="addProduct container">
<h2>Add new Product</h2>
<form>
<div class="form-group">
<label>Category</label>
<select class="form-control" v-model="category_id" required>
<option v-for="category of categories" :key="category.id" :value="category.id">{{category.categoryName}}</option>
</select>
</div>