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
fun missingNumber(input: IntArray): Int { | |
val n = input.size + 1 | |
val expectedSum = (n * (n + 1)) / 2 | |
val actualSum = input.sum() | |
return expectedSum - actualSum | |
} | |
fun missingNumber(input: IntArray): Int { | |
if(input.isEmpty() || input.count() == 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
fun reverseString(word: String): String { | |
var result = CharArray(word.length) | |
var counter = 0 | |
for(i in word.length - 1 downTo 0) { | |
result[counter] = word[i] | |
counter++ | |
} | |
return String(result) | |
} |
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
{ | |
"comments": [ | |
{ | |
"body": "Hellow world", | |
"createdAt": 1627349242, | |
"totalLikes": 12, | |
"liked": true, | |
"avatar": "https://avatars.githubusercontent.com/u/84214029?s=200&v=4", | |
"name": "sosmex bot" | |
}, |
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
public static void setAlarm(Context context) { | |
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); | |
Intent intent = new Intent(context, AlarmReceiver.class); | |
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0); | |
SessionManager manager = new SessionManager(context); | |
int minutos = manager.getInt(context.getString(R.string.pref_key_actualizacion)); | |
if (minutos == 0) { | |
minutos = 1; | |
} | |
alarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, |
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
/** | |
* An OnGlobalLayoutListener interface that will adjust and resize a fullscreen scene's view when the soft keyboard is shown | |
* or hidden. | |
* <p> | |
* Provides custom layout behavior to the 'adjustResize' windowSoftInputMode for a View layout by enforcing an adjustable | |
* container with the option of a static footer view. The adjustable container is "adjusted" by increasing or decreasing the | |
* view's translationY property equal to the distance of the adjustable view that was obscured by the soft keyboard. | |
* <p> | |
* When adhering to this interface, be sure to set the relevant Activity's windowSoftInputMode to 'adjustResize' so that the | |
* onGlobalLayout method is called when the keyboard is shown and dismissed. |
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
val appName = getString(R.string.app_name) | |
val placeHolder = getString(R.string.message_sos_alert_placeholder, "displayName", appName, featureConfig.shortCutAppUrl) | |
SmsReceiver.sendSMS(this, "5543136233", "Monica Vargas Velasco necesita ayuda a través de SOSMex descarga la app https://bit.ly/2TVb2bt http://maps.google.com/maps?f=q&q=(19.3832352,-99.0738685)") |
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
package com.aboolean.sosmex.dependencies.feature | |
import com.aboolean.sosmex.ui.home.menu.MenuItem | |
import com.aboolean.sosmex.utils.di.Country | |
import java.util.* | |
interface FeatureConfig { | |
val appId: String | |
val defaultLocale: Locale | |
val isCountryChooseEnabled: Boolean |
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
InputFilter filter = new InputFilter() { | |
public CharSequence filter(CharSequence source, int start, int end, | |
Spanned dest, int dstart, int dend) { | |
for (int i = start; i < end; i++) { | |
if (!Character.isLetterOrDigit(source.charAt(i))) { | |
return ""; | |
} | |
} | |
return null; | |
} |
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
public class MoneyEditText extends TextInputEditText { | |
public MoneyEditText(Context context) { | |
super(context); | |
} | |
public MoneyEditText(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} |
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
package com.naat.codinaat.utils | |
import android.util.Base64 | |
import android.util.Log | |
import javax.crypto.Cipher | |
import javax.crypto.spec.IvParameterSpec | |
import javax.crypto.spec.SecretKeySpec | |
object Aes128 { |
NewerOlder