This file contains hidden or 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
| function diff(arr1, arr2) { | |
| var newArr = []; | |
| for(var i=0;i<arr1.length;i++){ | |
| var check=1; | |
| for(j=0;j<arr2.length;j++){ | |
| if(arr1[i]===arr2[j]) | |
| check=0; | |
| } | |
| if(check===1) | |
| newArr.push(arr1[i]); |
This file contains hidden or 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
| /* | |
| Problem : LightOJ 1006 - Hex-a-bonacci | |
| Link : http://www.lightoj.com/volume_showproblem.php?problem=1006 | |
| Author : arsho | |
| Date : 05/09/2015 | |
| Source : C++ | |
| CPU : 0.008 | |
| Memory : 1688 | |
| */ | |
| #include <bits/stdc++.h> |
This file contains hidden or 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
| /* | |
| SUBMISSION TIME : 2015-10-23 01:53:21 | |
| USER : Ahmedur Rahman Shovon | |
| PROBLEM : 1006 - Hex-a-bonacci | |
| SOURCE : JAVA | |
| CPU : 0.320 | |
| MEMORY : 24100 | |
| VERDICT : Accepted | |
| */ | |
| import java.util.Scanner; |
This file contains hidden or 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 | |
| $_fp = fopen("php://stdin", "r"); | |
| while($line=fgets($_fp)){ | |
| $line = strtolower($line); | |
| $line_length = strlen($line); | |
| $char_ar=array(); | |
| for ($i=0;$i<$line_length;$i++){ | |
| $current_char = $line[$i]; | |
| if(preg_match('/^[a-z]$/',$current_char)){ | |
| $char_ar[$current_char] = 1; |
This file contains hidden or 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
| def digit_checking(a,b): | |
| x = a%10 | |
| y = b%10 | |
| check_match = 0 | |
| if x == y: | |
| check_match=1 | |
| a = a//10 | |
| b = b//10 | |
| if (a == 0) or (b == 0): | |
| return check_match |
This file contains hidden or 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
| function sumAll(arr) { | |
| var min = Math.min(arr[0] , arr[1]); | |
| var max = Math.max(arr[0] , arr[1]); | |
| var sum = 0; | |
| for(var i=min ; i<=max ; i++) { | |
| sum+=i; | |
| } | |
| return sum; | |
| } |
This file contains hidden or 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 | |
| $server_name = 'localhost'; | |
| $db_username = 'DB_USERNAME'; | |
| $db_password = 'DB_PASSWORD'; | |
| $db_name = 'DB_NAME'; | |
| try{ | |
| $conn = new PDO("mysql:host=$server_name;dbname=$db_name",$db_username,$db_password); | |
| $conn -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
This file contains hidden or 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
| def calculate_tax(income_dict): | |
| tax_dict = dict() | |
| for person_name in income_dict.keys(): | |
| person_income = income_dict[person_name] | |
| person_tax = 0 | |
| income_limit = [1000,10000,20200,30750,50000] | |
| income_range = [1000,9000,10200,10550,19250] | |
| tax_range = [0,.1,.15,.2,.25] | |
| for i in range(len(income_range)): | |
| if person_income <= 0: |
This file contains hidden or 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
| import matplotlib.pyplot as plt | |
| year = [2000,2001,2002,2003] | |
| popu = [1.00,1.50,2.00,2.50] | |
| y_pos = range(len(year)) | |
| plt.bar(y_pos,popu,label='Population',color='g', align='center') | |
| plt.xticks(y_pos, year) | |
| plt.legend() | |
| plt.xlabel('year') | |
| plt.ylabel('population') | |
| plt.show() |
This file contains hidden or 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
| // validation for ranging number | |
| $('.subject_mark').on("keyup", function () { | |
| this.value = this.value.replace(/[^0-9]/g, ''); | |
| var input_value = parseFloat(this.value); | |
| if (isNaN(input_value)===true) { | |
| $(this).val("0"); | |
| } else { | |
| var max_value = parseFloat($(this).attr('max')); | |
| if (input_value > max_value) { | |
| $(this).val(max_value); |
OlderNewer