https://www.codecademy.com/profiles/cloudJumper07218/certificates/240305d50b925c17868f1ac7a21a3261
Author Archives: omargamaleldeen
شهادة إتمام حفظ القرآن الكريم من جمعية تحفيظ القرآن بالرياض
1281. Subtract the Product and Sum of Digits of an Integer
1281. Subtract the Product and Sum of Digits of an Integer
class Solution {
public int subtractProductAndSum(int n) {
ArrayList<Integer> list = new ArrayList<Integer>();
while(n != 0){
list.add(n%10);
n = n/10;
}
int product = 1;
int sum = 0;
for(int i = 0; i < list.size(); i++){
product *= list.get(i);
sum+= list.get(i);
}
return product - sum;
}
}
شهادة شكر وتقدير

مجمع مشكاة التعليمى النموذجى لتعليم القرآن الكريم – جمعية تحفيظ القرآن بالرياض مكنون
شهادة شكر وتقدير ….يشهد مجمع مشكاة التعليمى النموذجى بأن المعلم: عمر جمال الدين شارك فى برنامج تعاهد الرابع عشر المقام بتاريخ 20/7/1444 هجريا فى جامع الشيخ محمد الجميح – رحمه الله – حيث قام بالتسميع للطلاب ….نسأل الله عز وجل أن ينفعه ويرفعه بالقرآن ..مدير الإدارة التعليمية ….صالح بن محمد الجدوع
896. Monotonic Array
class Solution {
public boolean isMonotonic(int[] nums) {
boolean increasing = true;
boolean decreasing = true;
for(int i = 1; i < nums.length; i++){
if(nums[i]< nums[i-1]) {
increasing = false;
break;
}
}
for( int i = 1; i < nums.length; i++){
if(nums[i]> nums[i-1]){
decreasing = false;
break;
}
}
return increasing|decreasing;
}
}
917. Reverse Only Letters
class Solution {
public String reverseOnlyLetters(String s) {
char[] arr = s.toCharArray();
int arrIndex = getNextEmpty(arr.length,arr);
for(int i = 0 ; i < s.length(); i++){
char c = s.charAt(i);
if((c>='a' && c <='z') ||
(c>='A' && c <='Z')){
arr[arrIndex] = c;
arrIndex = getNextEmpty(arrIndex,arr);
}
}
return new String(arr);
}
public int getNextEmpty(int current, char[] arr){
for(int i = current-1; i >=0; i--){
char c = arr[i];
if((c >='a' && c <='z') ||
(c>='A' && c <='Z')) return i;
}
return 0;
}
}
1603. Design Parking System
class ParkingSystem {
static int big = 0;
static int medium = 0;
static int small = 0;
public ParkingSystem(int big1, int medium1, int small1) {
big = big1;
medium = medium1;
small = small1;
}
public boolean addCar(int carType) {
if(carType == 1){
if(big >= 1){
big--;
return true;
}else return false;
}else if(carType == 2){
if(medium >= 1){
medium--;
return true;
} else return false;
}else if (carType == 3){
if(small >= 1){
small--;
return true;
}else return false;
}
return false;
}
}
/**
* Your ParkingSystem object will be instantiated and called as such:
* ParkingSystem obj = new ParkingSystem(big, medium, small);
* boolean param_1 = obj.addCar(carType);
*/
2114. Maximum Number of Words Found in Sentences
2114. Maximum Number of Words Found in Sentences
class Solution {
public int mostWordsFound(String[] sentences) {
int max = Integer.MIN_VALUE;
for(int i = 0; i < sentences.length; i++){
max = Math.max(max, sentences[i].split(" ").length);
}
return max;
}
}
1492. The kth Factor of n
class Solution {
public int kthFactor(int n, int k) {
for(int i = 1 ; i <= n; i++){
if((n%i) ==0 ){
if( k == 1) return i;
k--;
}
}
return -1;
}
}

