Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem code:ARTBALAN added #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions C++/Where is the Marble? (10474).cpp

This file was deleted.

12 changes: 6 additions & 6 deletions Contributors.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Contributors of this repository
<!-- To add your name to the repository contributors, Use this template below: -->
1. [Nirav Madariya](http://github.com/niravmadariya)
2. [Chandu Siddartha](https://github.com/siddartha19/)
3. [Matheus Muriel](https://github.com/MatheusMuriel/)
# Contributors of this repository
<!-- To add your name to the repository contributors, Use this template below: -->

1. [Nirav Madariya](http://github.com/niravmadariya)
2. [Chandu Siddartha](https://github.com/siddartha19/)
3. [Matheus Muriel](https://github.com/MatheusMuriel/)
4. [Priyanshu Tiwari](https://github.com/tpriyanshu90)
1 change: 0 additions & 1 deletion HTML/FORM
Submodule FORM deleted from c25e42
18 changes: 9 additions & 9 deletions PHP/MySQL_in_app_azure.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
$conn = getenv("MYSQLCONNSTR_localdb"); // this will return the whole connectionstring in a single string
$conarr2 = explode(";",$conn); // Let's beautify it, by splitting it and decorating it in an array
$conarr = array();
foreach($conarr2 as $key=>$value){
$k = substr($value,0,strpos($value,'='));
$conarr[$k] = substr($value,strpos($value,'=')+1);
}
print_r($conarr); // $conarr is an array of values of connection string
<?php
$conn = getenv("MYSQLCONNSTR_localdb"); // this will return the whole connectionstring in a single string
$conarr2 = explode(";",$conn); // Let's beautify it, by splitting it and decorating it in an array
$conarr = array();
foreach($conarr2 as $key=>$value){
$k = substr($value,0,strpos($value,'='));
$conarr[$k] = substr($value,strpos($value,'=')+1);
}
print_r($conarr); // $conarr is an array of values of connection string
?>
62 changes: 62 additions & 0 deletions codechef/Art of Balance-ARTBALAN.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
int t,ch,freq;
cin >> t;
while(t--)
{
long int ans=INT_MAX,op=INT_MAX;
string s;
cin >> s;
cin.ignore(numeric_limits<streamsize>::max(),'\n');
map < char , int > mp;
for(int i=0;i<s.length();i++)
{
if( (mp.find(s[i])) != mp.end() )
mp[s[i]]++;
else
mp.insert({s[i],1});
}
vector <int> v;
for(map < char , int >::iterator it=mp.begin();it!=mp.end();it++)
v.push_back(it->second);
sort(v.begin(),v.end());
ch=v.size();
for(int i=1;i<=26;i++)
{
vector<int> p=v;
if(((s.length())%i)==0)
{
ans=0;
freq=(s.length())/i;
if(i<ch)
{
int m=ch-i;
for(int i=0;i<m;i++)
ans+=p[i];
for(int i=0;i<p.size();i++)
p[i]-=freq;
vector <int>::iterator itr,it=upper_bound(p.begin(),p.end(),0);
for(itr=it;itr!=p.end();itr++)
ans+=(*itr);
}
else //if(i>ch)
{
for(int i=0;i<p.size();i++)
p[i]-=freq;
vector <int>::iterator itr,it=upper_bound(p.begin(),p.end(),0);
for(itr=it;itr!=p.end();itr++)
ans+=(*itr);
}
}
op=std::min(op,ans);
}
cout << op << endl;
}
}